[SERVER-20191] multi-updates/remove can make successive queries skip shard version checking Created: 28/Aug/15  Updated: 25/Jan/17  Resolved: 10/Sep/15

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 2.6.11, 3.0.6, 3.1.7
Fix Version/s: 2.6.12, 3.0.7, 3.1.8

Type: Task 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

Attachments: File test.js    
Issue Links:
Related
is related to SERVER-20279 OperationShardVersion::get should ret... Closed
Backwards Compatibility: Fully Compatible
Backport Completed:
Sprint: Sharding 9 (09/18/15)
Participants:

 Description   

Multi-updates are currently unversioned and part of the update execution code path sets the version of the connection to "ignored":

https://github.com/mongodb/mongo/blob/r3.1.7/src/mongo/db/commands/write_commands/batch_executor.cpp#L844

This is fine if the connections are used exclusively by write commands as the version information always comes together with the command request and will be reset every time. However, versioned opQuery requests are stateful and rely on the fact that the connection it uses has the shard version information in it. If a connection is initialized with a version and a multi-update/remove gets issued on the same connection afterwards, it will make the connection become "unversioned" for that namespace and succeeding queries using that connection will skip version checking for that namespace until a non-multi write command resets the connection version to something that is not "ignored".

The attached test.js demonstrates this behavior.



 Comments   
Comment by Githook User [ 10/Sep/15 ]

Author:

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

Message: SERVER-20191 multi-updates/remove can make successive queries skip shard version checking

(cherry picked from commit d79fdd83e4eb940d3d98f73f6f492f58c5a8dde5)

Conflicts:
src/mongo/db/commands/write_commands/batch_executor.cpp
Branch: v2.6
https://github.com/mongodb/mongo/commit/402212e48504ff9e5c9695bfc348a967cb5a2aaf

Comment by Githook User [ 08/Sep/15 ]

Author:

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

Message: SERVER-20191 multi-updates/remove can make successive queries skip shard version checking
Branch: v3.0
https://github.com/mongodb/mongo/commit/d79fdd83e4eb940d3d98f73f6f492f58c5a8dde5

Comment by Githook User [ 08/Sep/15 ]

Author:

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

Message: SERVER-20191 multi-updates/remove can make successive queries skip shard version checking
Branch: master
https://github.com/mongodb/mongo/commit/526742267e208954e531c102784c0599ceba579f

Comment by Andy Schwerin [ 31/Aug/15 ]

renctan, can you please describe how this can happen in the ticket description?

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