-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Sharding
-
None
-
Fully Compatible
-
v6.0, v5.0
-
Sharding 2021-10-18, Sharding 2021-11-01, Sharding 2021-11-15, Sharding 2021-11-29, Sharding 2021-12-13, Sharding 2021-12-27, Sharding 2022-01-10, Sharding 2022-01-24, Sharding 2022-02-07, Sharding 2022-02-21, Sharding 2022-03-07, Sharding NYC 2022-03-21, Sharding NYC 2022-04-04, Sharding NYC 2022-04-18, Sharding 2022-05-02, Sharding NYC 2022-05-16, Sharding NYC 2022-05-30, Sharding NYC 2022-06-13, Sharding 2022-06-27
-
(copied to CRM)
-
173
When a collection is sharded or its shard key is refined, a "useful" index must exist on the collection that supports the proposed shard key (as defined in this comment). Verifying this involves both inspecting the collection's listIndexes output and running the checkShardingIndex command on a shard. An index with the shard key pattern can be invalid for several reasons (e.g. it's multikey, partial, sparse, has a collation, or is in the process of being built) but the error messages returned for many of these cases is the same, which can make diagnosing failures difficult. (Message when listIndexes finds no candidate index and message when checkShardingIndex finds no valid index.)
Instead, the command should return more information as to why there is no valid index. In particular, the error should at least differentiate these cases:
- No index exists with the shard key pattern as a prefix at all
- An otherwise valid index exists, but is multikey, partial, sparse, is being built, or has a collation
- is related to
-
SERVER-48471 Hashed indexes may be incorrectly marked multikey and be ineligible as a shard key
- Closed
- related to
-
SERVER-85502 Update the shard key prefix error description in v4.4 to match other versions
- Closed