[SERVER-69874] Document or possibly mitigate scenario where shards end up with different prepareUnique and unique index settings Created: 21/Sep/22 Updated: 29/Oct/23 Resolved: 08/Nov/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Catalog, Sharding |
| Affects Version/s: | None |
| Fix Version/s: | 6.1.1, 6.0.4, 6.2.0-rc0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Max Hirschhorn | Assignee: | Yuhong Zhang |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Backport Requested: |
v6.1, v6.0
|
||||||||||||||||
| Sprint: | Execution Team 2022-10-17, Execution Team 2022-10-31, Execution Team 2022-11-14 | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
This isn't a new inconsistency for indexes on a sharded collection but a new way for an inconsistency to manifest. For comparison, the createIndexes command broadcasted by mongos to all shards which own a chunk for the sharded collection can fail on one shard and succeed on another (same for the dropIndexes command). The main consequence is it can lead to chunk migrations failing with a DuplicateKey exception because shards are enforcing different index constraints from each other. Let's say there is a collection sharded on {x: 1} which lives on 2 shards and has a non-unique index {x: 1, y: 1}.
A chunk migration between the 2 shards may fail with a DuplicateKey error due to the (x, y) pairs not being globally unique across all shards. Removing the duplicates and retrying the collMod command is run with {unique: true} may not be practical. However the cluster operator is also left without a means of converting the {x: 1, y: 1} index back to being a non-unique index. |
| Comments |
| Comment by Githook User [ 21/Nov/22 ] |
|
Author: {'name': 'Yuhong Zhang', 'email': 'yuhong.zhang@mongodb.com', 'username': 'YuhongZhang98'}Message: (cherry picked from commit 78131d8e3da7114a037d55add0483a82a5133bd8) |
| Comment by Githook User [ 18/Nov/22 ] |
|
Author: {'name': 'Yuhong Zhang', 'email': 'yuhong.zhang@mongodb.com', 'username': 'YuhongZhang98'}Message: (cherry picked from commit 78131d8e3da7114a037d55add0483a82a5133bd8) |
| Comment by Githook User [ 09/Nov/22 ] |
|
Author: {'name': 'Yuhong Zhang', 'email': 'yuhong.zhang@mongodb.com', 'username': 'YuhongZhang98'}Message: |
| Comment by Githook User [ 08/Nov/22 ] |
|
Author: {'name': 'Yuhong Zhang', 'email': 'yuhong.zhang@mongodb.com', 'username': 'YuhongZhang98'}Message: |