Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-74773

Make analyzeShardKey command use the most compatible index to calculate cardinality and frequency metrics

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • Sharding NYC 2023-03-20

      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. 

            Assignee:
            cheahuychou.mao@mongodb.com Cheahuychou Mao
            Reporter:
            cheahuychou.mao@mongodb.com Cheahuychou Mao
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: