analyzeShardKey command misclassifies queries with $expr equality on the shard key

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 7.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • Sharding NYC 2023-04-03
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The analyzeShardKey command currently relies on extractShardKeyFromBasicQuery() to extract the shard key from a filter, and it classifies every query that has an empty shard key as not targeting a single shard. The helper cannot handle a filter with $expr. As a result, the analyzeShardKey command currently misclassifies a query that filters by $expr equality on the shard key, for example,
      {$expr: {$eq: [$shardKeyField, "$$value"]}. The command should not extract the shard key by itself and instead make use of the query index bounds info determined by getShardIdsForQuery()

              Assignee:
              Cheahuychou Mao
              Reporter:
              Cheahuychou Mao
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: