[SERVER-74773] Make analyzeShardKey command use the most compatible index to calculate cardinality and frequency metrics Created: 13/Mar/23  Updated: 29/Oct/23  Resolved: 14/Mar/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.0.0-rc0

Type: Bug Priority: Major - P3
Reporter: Cheahuychou Mao Assignee: Cheahuychou Mao
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding NYC 2023-03-20
Participants:

 Description   

The analyzeShardKey command currently simply uses the first prefixed index that it sees when it goes through the indexes in the IndexCatalog. However, consider the case the shard key being analyzed is {x: 1} and the collection has two indexes {x: 1, y: 1} which is a not unique index and
{x: 1} which is a unique index. If the index {x: 1, y: 1} shows up first in the IndexCatalog then the command would return the the shard key is not unique although it is. 



 Comments   
Comment by Githook User [ 14/Mar/23 ]

Author:

{'name': 'Cheahuychou Mao', 'email': 'mao.cheahuychou@gmail.com', 'username': 'cheahuychou'}

Message: SERVER-74773 Make analyzeShardKey command use the most compatible index to calculate cardinality and frequency metrics
Branch: master
https://github.com/mongodb/mongo/commit/1b7c76d3e66c123bbc64b41ae9a0ded6ba3de6a9

Generated at Thu Feb 08 06:28:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.