-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 3.4.0-rc3
-
Component/s: Replication
-
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:
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:
- Client sends drop command to mongos.
- Drop command times out waiting for write concern at mongod.
- Mongos retries command since write concern timeout is a retriable error with Shard::RetryPolicy::kIdempotent.
- Mongos retries drop command to mongod.
- Since collection is already dropped, it will get "ns does not exist" error.
- 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).
- is related to
-
SERVER-84081 FLE2 write error hides write concern error
- Backlog
-
SERVER-35387 Ensure retried commitTransaction command waits for writeConcern
- Closed
- related to
-
SERVER-25765 Commands should wait for write concern even if they throw an exception
- Closed
-
SERVER-30648 Set GlobalLockAcquisitionTracker after we waitForLock
- Closed
-
SERVER-33475 Retried findAndModify doesn't properly wait for writeConcern
- Closed
-
SERVER-33727 Do not wait for write concern if opTime didn't change during write
- Closed
-
SERVER-40965 createIndexes should set the latest optime on its opCtx to meet writeConcern if no indexes are found to need building
- Closed