[SERVER-5710] Update may result in doc without shard key Created: 25/Apr/12 Updated: 11/Jul/16 Resolved: 16/Jan/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Sharding |
| Affects Version/s: | None |
| Fix Version/s: | 2.4.0-rc0 |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | Scott Hernandez (Inactive) | Assignee: | Alberto Lerner |
| Resolution: | Done | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Operating System: | ALL | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
If you include the shard-key in the query, but it is removed in the update operations, then the resulting inserted document will not contain the shard key, and will be lost to the sharded system queries. Mongos should probably build the possibly inserted document to verify the shard-key exists in it before sending the update to the shard. Take these examples
|
| Comments |
| Comment by auto [ 16/Jan/13 ] |
|
Author: {u'date': u'2013-01-16T15:36:40Z', u'email': u'alerner@10gen.com', u'name': u'Alberto Lerner'}Message: |
| Comment by Randolph Tan [ 30/Nov/12 ] |
|
Current state of master branch, commit 5a4b6a0acc92c171e7b8fd7fecd26585e76b60be: First example fails with: Can't modify shard key's value. -> fixed |
| Comment by Scott Hernandez (Inactive) [ 25/Apr/12 ] |
|
Probably better to actually move this check to the shard by simply not allow writing to any data which that shard does not own. On sharded connections this should enforce that the shard owns the doc, by shard-key, before the write is allowed. On non-sharded connections this should let everything pass. |