-
Type:
Bug
-
Status: Closed
-
Priority:
Major - P3
-
Resolution: Fixed
-
Affects Version/s: 4.2.0, 4.4.0
-
Labels:
-
Backwards Compatibility:Fully Compatible
-
Operating System:ALL
-
Backport Requested:v4.4, v4.2
-
Sprint:Execution Team 2020-09-07, Execution Team 2021-01-11
-
Case:
If an index build on a hashed index is concurrent with any collection writes, the index may be incorrectly marked multikey. As a result, this index can not be used as the shard key on a sharded collection.
Original title: shardCollection fails with "couldn't find valid index for shard key" despite index existing
Original description:
I'm attempting to shard a number of existing collections. They were all created and populated in a standalone mongod which has now been converted to a sharded cluster. Some of the collections have sharded successfully, others have failed with the above error. A possible cause of this was that the indexes were in the process of being created (with the background: true option) when the shardCollection command was first run, due to the script used not waiting for the background creation to complete.
- related to
-
SERVER-50792 Return more useful errors when a shard key index can't be found for shardCollection/refineCollectionShardKey
-
- Open
-
- links to