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

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

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.6.11, 3.0.6, 3.1.7
    • Fix Version/s: 2.6.12, 3.0.7, 3.1.8
    • Component/s: Sharding
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Backport Completed:
    • Sprint:
      Sharding 9 (09/18/15)

      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.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: