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