[SERVER-75312] analyzeShardKey command misclassifies queries with $expr equality on the shard key Created: 27/Mar/23  Updated: 29/Oct/23  Resolved: 28/Mar/23

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

Type: Task 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
Sprint: Sharding NYC 2023-04-03
Participants:

 Description   

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()



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

Author:

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

Message: SERVER-75312 Make sure analyzeShardKey command can handle queries with $expr equality
Branch: master
https://github.com/mongodb/mongo/commit/3e44409d23b9924ceca60bb2429382fbcc8fc0c3

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