[SERVER-30970] Don't allow single-updates that aren't targetted on the shard key Created: 06/Sep/17 Updated: 12/Dec/23 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Sharding |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Spencer Brody (Inactive) | Assignee: | Backlog - Cluster Scalability |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | LamontN | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Assigned Teams: |
Cluster Scalability
|
||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Description |
|
Single document updates usually need to specify an exact match on the shard key to be allowed, so that mongos knows it can send it to a single shard and be guaranteed to only update a single document. If, however, your shard key doesn't include _id, we allow you to do a single update that matches on _id but not the shard key. This will result in sending the write to all shards, with the expectation that only one shard will contain a document with that _id. Since we don't enforce uniqueness of _id in a sharded cluster that's not sharded on _id, however, that assumption is incorrect and a single update could in fact wind up updating multiple unrelated documents. |
| Comments |
| Comment by Spencer Brody (Inactive) [ 06/Sep/17 ] |
|
This can also cause updates to orphaned documents left behind by failed chunk migrations, which can result in spurious change stream notifications. |