[SERVER-65382] AutoSplitVector should not use clientReadable to reorder shard key fields Created: 08/Apr/22 Updated: 29/Oct/23 Resolved: 16/Aug/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 4.4.17, 5.0.12, 6.0.2, 6.1.0-rc0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Allison Easton | Assignee: | Jordi Serra Torrens |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | sharding-wfbf-day | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||
| Issue Links: |
|
||||
| Backwards Compatibility: | Fully Compatible | ||||
| Operating System: | ALL | ||||
| Backport Requested: |
v6.0, v5.0, v4.4
|
||||
| Sprint: | Sharding EMEA 2022-08-08, Sharding EMEA 2022-08-22 | ||||
| Participants: | |||||
| Description |
|
The clientReadable function converts MinKey into {$minElement: 1} for readability purposes. However, the bsonObj {$minElement: 1} does not compare as less than all values the same way that MinKey does. This is fine for the prettyKey function for logging, but can cause issues when used in the orderShardKeyFields function, whose results are compared. The repro included in this patch triggers the dassert about shard key ordering because the comparison of null and {$minElement: 1} returns null < {$minElement: 1} while minKey should be less than null. This problem is also present in splitvector - as part of this ticket we should investigate whether this can cause problems on older versions. |
| Comments |
| Comment by Githook User [ 23/Aug/22 ] |
|
Author: {'name': 'Jordi Serra Torrens', 'email': 'jordi.serra-torrens@mongodb.com', 'username': 'jordist'}Message: (cherry picked from commit 56dab5c0dcfbebcc2f5910a82f78dd4678620532) |
| Comment by Benety Goh [ 18/Aug/22 ] |
|
Author: {'name': 'Jordi Serra Torrens', 'email': 'jordi.serra-torrens@mongodb.com', 'username': 'jordist'}Message: |
| Comment by Jordi Serra Torrens [ 10/Aug/22 ] |
|
I believe older versions are also affected by this, but they don't trigger the 'dassert' because it was first introduced on v5.3 by So even though it won't hit any dassert on older versions, I think the splitter might still produce incorrect results because of this bug, so I think we should backport the fix. |