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

Some Commands do not wait for write concern for no-op writes

    XMLWordPrintable

    Details

    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v3.4, v3.2
    • Sprint:
      Repl 2017-01-23, Repl 2017-02-13, Repl 2017-04-17, Repl 2017-05-08, Repl 2017-05-29, Repl 2017-07-31
    • Linked BF Score:
      0

      Description

      The wait for write concern code returns early if the ReplClientInfo is not set:

      https://github.com/mongodb/mongo/blob/r3.4.0-rc3/src/mongo/db/write_concern.cpp#L223-L226

      This means that if certain commands that does write actually ends up as no-op, it will actually not end up waiting for write concern.

      Example case:

      1. Client sends drop command to mongos.
      2. Drop command times out waiting for write concern at mongod.
      3. Mongos retries command since write concern timeout is a retriable error with Shard::RetryPolicy::kIdempotent.
      4. Mongos retries drop command to mongod.
      5. Since collection is already dropped, it will get "ns does not exist" error.
      6. If the mongos used a new connection, it will not wait for replication at all because it does not have any client opTime set. However, if the same connection is used, it will wait for the write concern as expected.

      Some of the commands already wait for write concern correctly even though it ends up doing a no-op write via repl::ReplClientInfo::setLastOpToSystemLastOpTime (for example, findAndModify, write commands, applyOps, etc).

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: