[SERVER-76719] analyzeShardKey command can return incorrect monotonicity for compound hashed shard keys Created: 01/May/23  Updated: 29/Oct/23  Resolved: 02/May/23

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

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

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v7.0
Sprint: Sharding NYC 2023-05-15
Participants:
Linked BF Score: 0

 Description   

Currently, shard keys with a hashed field are handled as follows. If the number of fields is 1, then the analyzeShardKey command would just return "not monotonic". If the number of fields is > 1, the command would instead try to infer its monotonicity from the correlation coefficient of the recordIds. The latter is incorrect since hashing introduces randomness so it is meaningless to calculate the correlation coefficient of recordIds in a hashed index. According to BF-28591, this is causing a monotonic shard key to be reported as "not monotonic" and vice versa.



 Comments   
Comment by Githook User [ 02/May/23 ]

Author:

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

Message: SERVER-76719 Make analyzeShardKey command set the monotonicity for hashed compound shard keys to 'unknown' if the hashed field isn't the first field

(cherry picked from commit 2a4172c5251901b2ab725e829d55b52eae6bb3aa)
Branch: v7.0
https://github.com/mongodb/mongo/commit/ae3068fd18bfdb76fd84783dfb4365d0025be58a

Comment by Githook User [ 01/May/23 ]

Author:

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

Message: SERVER-76719 Make analyzeShardKey command set the monotonicity for hashed compound shard keys to 'unknown' if the hashed field isn't the first field
Branch: master
https://github.com/mongodb/mongo/commit/2a4172c5251901b2ab725e829d55b52eae6bb3aa

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