Database Manual / Sharding / Reference / Inconsistency Types

CorruptedZoneShardKey

Description描述

CorruptedZoneShardKey

The routing table contains a zone with a min key or max key that doesn't correspond to the collection shard key.路由表包含一个区域,其最小键或最大键与集合分片键不对应。

New in version 7.0.在版本7.0中新增。

Format格式

{
type: "CorruptedZoneShardKey",
description: "<string>",
details: {
namespace: "<string>",
collectionUUID: UUID("<uuid>"),
zone: <zone>,
shardKeyPattern: <pattern>
}
}

CorruptedZoneShardKey inconsistency documents contain the following fields:不一致文档包含以下字段:

Field字段Type类型Description描述
typestring字符串Type of inconsistency document. Returns a value of CorruptedZoneShardKey for this inconsistency type.不一致文档的类型。返回此不一致类型的CorruptedZoneHardKey值。
descriptionstring字符串Describes the inconsistency found in the metadata.描述元数据中发现的不一致。
detailsdocument文档Document with additional information on where the inconsistency exists in the database and sharded cluster.包含数据库和分片集群中不一致位置的附加信息的文档。
details.namespacestring字符串Indicates the database and collection where the inconsistency exists.指示存在不一致的数据库和集合。
details.collectionUUIDUUIDUUID of the collection with the corrupted zone shard key.具有损坏的区域分片键的集合的UUID。
details.zonedocument文档Zone with the corrupted shard key.带有损坏的分片键的区域。
details.shardKeyPatterndocument文档Collection shard key pattern.集合分片键模式。

Example示例

Use the db.adminCommand() method to call the checkMetadataConsistency command:使用db.adminCommand()方法调用checkMetadataConsistency命令:

db.adminCommand( { checkMetadataConsistency: 1 } )

The method returns a cursor with a batch of documents showing the inconsistencies found in the sharding metadata. The example below shows a cursor with a CorruptedZoneShardKey inconsistency document:该方法返回一个游标,其中包含一批文档,显示分片元数据中发现的不一致。下面的示例显示了一个带有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
}