Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-20191

multi-updates/remove can make successive queries skip shard version checking

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.6.12, 3.0.7, 3.1.8
    • Affects Version/s: 2.6.11, 3.0.6, 3.1.7
    • Component/s: Sharding
    • None
    • Fully Compatible
    • Sharding 9 (09/18/15)

      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.

            Assignee:
            randolph@mongodb.com Randolph Tan
            Reporter:
            randolph@mongodb.com Randolph Tan
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: