[SERVER-39630] Allow updates to the shard key value only when the document will not change shards Created: 15/Feb/19 Updated: 29/Oct/23 Resolved: 20/Mar/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Sharding |
| Affects Version/s: | None |
| Fix Version/s: | 4.1.10 |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Janna Golden | Assignee: | Janna Golden |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Sprint: | Sharding 2019-02-25, Sharding 2019-03-11, Sharding 2019-03-25 |
| Participants: |
| Description |
|
This ticket is to allow users to run an update that will change a document shard key value only when the document will not change shards. We should no longer throw an ImmutableField error in ModifierNode or ObjectReplaceNode unless the _id field is changed. We will error if the update is sent with multi: true, if it's sent as part of a batch with size > 1, or if it is sent without either retryWrites: true or autocommit: false. Once this ticket is finished, we will still error if an update is sent that will cause the document to change shards. |
| Comments |
| Comment by Githook User [ 20/Mar/19 ] |
|
Author: {'email': 'golden.janna@gmail.com', 'name': 'jannaerin', 'username': 'jannaerin'}Message: |
| Comment by Githook User [ 19/Mar/19 ] |
|
Author: {'email': 'golden.janna@gmail.com', 'name': 'jannaerin', 'username': 'jannaerin'}Message: Revert " This reverts commit d1596a9693b9442dda1492934cf9bc26ad66176d. |
| Comment by Githook User [ 19/Mar/19 ] |
|
Author: {'name': 'jannaerin', 'username': 'jannaerin', 'email': 'golden.janna@gmail.com'}Message: |
| Comment by Janna Golden [ 22/Feb/19 ] |
|
kaloian.manassiev no, we don't want to throw ImmutableError anymore unless the user tries to update _id. At the point in the update logic where we throw the ImmutableError currently, we cannot tell whether the change would cause the document to move shards or not so we'll actually need to check for this higher up in the update logic stack. |
| Comment by Kaloian Manassiev [ 22/Feb/19 ] |
|
This will presumably only happen if the change would not cause the shard key to move shards, right? (Please update the description) |