[SERVER-17805] logOp / OperationObserver should always check shardversion Created: 30/Mar/15  Updated: 25/Jan/17  Resolved: 01/Apr/15

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 3.0.1
Fix Version/s: 2.6.10, 3.0.2, 3.1.1

Type: Bug Priority: Major - P3
Reporter: Randolph Tan Assignee: Randolph Tan
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Duplicate
is duplicated by SERVER-11746 Improve shard version checking for ve... Closed
is duplicated by SERVER-17585 Enforce shard version after yields on... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Completed:
Sprint: Sharding 2 04/24/15
Participants:

 Description   

Proposed title: logOp / OperationObserver should always check shardversion

Issue Status as of Apr 02, 2015

ISSUE SUMMARY
Sharded write operations that affect single documents (i.e. updates without the multi option, or remove operations with justOne=True), should always ensure that write operations are being applied directly to the correct shard to avoid loosing some write operations during chunk migration.

USER IMPACT
Could cause a limited set of operations that modified orphaned data to report success, inaccurately.

In 3.0.0 and 3.0.1, if you encounter this issue using a command that writes data but is not insert, update, or delete, (e.g. findAndModify, mongod itself may may terminate on this issue.

WORKAROUNDS
None.

AFFECTED VERSIONS
2.6+ and 3.0+

FIX VERSION
The fix is included in the 3.0.2 production release.

Original description

If a shard's notion of its shard version for a collection changes after a single-document operation has established the operation's expected shard version for the collection on that shard, any call to logOp() by that operation should trigger a shard version error and rollback of the operation.

Multi-document operations, such as multi:true updates and justOne: false deletes are inherently unversioned in the current protocol, and so shard version mismatches for those operations should not result in error propagation.

– from original description –
The shard needs to send a version error as a response when the shard version changed right after a non-multi update (the writes that failed to be included in the transfer mod phase of the migration).



 Comments   
Comment by Githook User [ 16/Apr/15 ]

Author:

{u'username': u'renctan', u'name': u'Randolph Tan', u'email': u'randolph@10gen.com'}

Message: SERVER-17805 logOp / OperationObserver should always check shardversion

(cherry picked from commit fe8a41689e861f6fd1b599cbd63e651b9077edaf)

Conflicts:
src/mongo/db/commands/write_commands/batch_executor.cpp
src/mongo/s/d_migrate.cpp
Branch: v2.6
https://github.com/mongodb/mongo/commit/003520d8d6190beedb7a7a2a1d2b77ef7a974adf

Comment by Githook User [ 02/Apr/15 ]

Author:

{u'username': u'renctan', u'name': u'Randolph Tan', u'email': u'randolph@10gen.com'}

Message: SERVER-17805 logOp / OperationObserver should always check shardversion

Edit backport for C++03 compatibility
Branch: refs/tags/r3.0.2-rc0
https://github.com/mongodb/mongo/commit/8ea72d1e0a9742a13eeb68f5639778cde14ea4cb

Comment by Githook User [ 02/Apr/15 ]

Author:

{u'username': u'renctan', u'name': u'Randolph Tan', u'email': u'randolph@10gen.com'}

Message: SERVER-17805 logOp / OperationObserver should always check shardversion

Edit backport for C++03 compatibility
Branch: v3.0
https://github.com/mongodb/mongo/commit/7ecaf439780d60e9e6b316ddf90904bd9a61726d

Comment by Githook User [ 01/Apr/15 ]

Author:

{u'username': u'renctan', u'name': u'Randolph Tan', u'email': u'randolph@10gen.com'}

Message: SERVER-17805 logOp / OperationObserver should always check shardversion

(cherry picked from commit fe8a41689e861f6fd1b599cbd63e651b9077edaf)

Conflicts:
src/mongo/s/d_migrate.cpp
Branch: v3.0
https://github.com/mongodb/mongo/commit/4e3454c93f93185dd8cdecd33f88789cc8fbc32f

Comment by Githook User [ 01/Apr/15 ]

Author:

{u'username': u'renctan', u'name': u'Randolph Tan', u'email': u'randolph@10gen.com'}

Message: SERVER-17805 logOp / OperationObserver should always check shardversion
Branch: master
https://github.com/mongodb/mongo/commit/fe8a41689e861f6fd1b599cbd63e651b9077edaf

Comment by Andy Schwerin [ 30/Mar/15 ]

On the 3.0 branch, it probably makes sense to put this change into logOp(), whereas in 3.2, it makes sense to put it into logOpForSharding or its successor in the OperationObserver design.

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