[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: SERVER-39630 Allow updates to the shard key value only when the document will not change shards
Branch: master
https://github.com/mongodb/mongo/commit/9713b6260c1898eb210da8597766faab94a40420

Comment by Githook User [ 19/Mar/19 ]

Author:

{'email': 'golden.janna@gmail.com', 'name': 'jannaerin', 'username': 'jannaerin'}

Message: Revert "SERVER-39630 Allow updates to the shard key value only when the document will not change shards"

This reverts commit d1596a9693b9442dda1492934cf9bc26ad66176d.
Branch: master
https://github.com/mongodb/mongo/commit/65b8d0a273fd1f03567b297743e22650b2035dd2

Comment by Githook User [ 19/Mar/19 ]

Author:

{'name': 'jannaerin', 'username': 'jannaerin', 'email': 'golden.janna@gmail.com'}

Message: SERVER-39630 Allow updates to the shard key value only when the document will not change shards
Branch: master
https://github.com/mongodb/mongo/commit/d1596a9693b9442dda1492934cf9bc26ad66176d

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)

Generated at Thu Feb 08 04:52:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.