Proposed title: logOp / OperationObserver should always check shardversion
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.
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.
2.6+ and 3.0+
The fix is included in the 3.0.2 production release.
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).
- is duplicated by
SERVER-11746 Improve shard version checking for versioned (single) updates after yield
SERVER-17585 Enforce shard version after yields on versioned (single) deletes