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

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

    • Fully Compatible
    • ALL
    • v3.4, v3.2
    • Repl 2017-01-23, Repl 2017-02-13, Repl 2017-04-17, Repl 2017-05-08, Repl 2017-05-29, Repl 2017-07-31
    • 0

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


      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).

            judah.schvimer@mongodb.com Judah Schvimer
            randolph@mongodb.com Randolph Tan
            0 Vote for this issue
            7 Start watching this issue