损坏的区域分片键
描述
格式
{ type: "CorruptedZoneShardKey", description: "<string>", details: { namespace: "<string>", collectionUUID: UUID("<uuid>"), zone: <zone>, shardKeyPattern: <pattern> } }
CorruptedZoneShardKey
不一致性文档包含以下字段
字段 | 类型 | 描述 |
---|---|---|
类型 | 字符串 | 不一致文档的类型。对于此不一致类型,返回值为 |
描述 | 字符串 | 描述在元数据中找到的不一致性。 |
详细信息 | 文档 | 包含数据库和分片集群中不一致存在位置的附加信息的文档。 |
详细信息.namespace | 字符串 | 指示存在不一致的数据库和集合。 |
详细信息.collectionUUID | UUID | 损坏区域分片键的集合的 UUID。 |
详细信息.zone | 文档 | 包含损坏分片键的区域。 |
详细信息.shardKeyPattern | 文档 | 集合分片键模式。 |
示例
使用db.adminCommand()
方法调用 checkMetadataConsistency
命令
db.adminCommand( { checkMetadataConsistency: 1 } )
该方法返回一个包含在分片元数据中找到的不一致性的文档批次的游标。下面的示例显示了包含 CorruptedZoneShardKey
不一致性文档的游标
{ cursor: { id: Long("0"), ns: "test.$cmd.aggregate", firstBatch: [ { type: "CorruptedZoneShardKey", description: "Found zone with a shard key pattern violation", details: { namespace: "test.authors", collection: { collectionUUID : new UUID("1ad56770-61e2-48e9-83c6-8ecefe73cfc4"), zone : { ns : "test.authors", tag: "64ddd81656be208c6685da21", min: { y: 0 }, max: { x: MaxKey } }, shardKeyPattern: { x: 1 } } } } ], }, ok: 1 }