SERVER-131327ClosedFixed

checkMetadataConsistency may return MissingShardKeyIndex false positive when migrating the first chunk to a shard

We only [check that a sharded collection is supported by a valid shard key index under the optimistic check|https://github.com/mongodb/mongo/blob/37ff58cbd999dd136497bb28e4ab9a6d96e83b65/src/mongo/db/global_catalog/metadata_consistency_validation/metadata_consistency_util.cpp#L1237-L1245] (only holding the DDL lock, but not collection locks). A chunk migration does not acquire the DDL lock, so checkMetadataConsistency may observes the intermediate state where the collection has been cloned by th

Affected Versions
Versions known to exhibit this issue
8.3.0-rc08.2.09.0.0-rc09.1.0-rc0
Fixed Versions
Versions that include the fix
9.1.0-rc09.0.48.3.16
Components
Server components related to this issue
Sharding
Labels
Tags and classification
bkp