When a retryable write would change a document's shard key value and cause that document to move chunks, mongos will internally use a transaction to atomically delete and insert the document with the new value. As part of this, mongos will re-run the original command received from the user in a transaction (e.g. in findAndModify), which will fail if the command included a write concern, because write concern is not allowed in a transaction before commit/abort.
Instead the write concern should only be applied at the commit/abort of the internal transaction.
- is related to
-
SERVER-44593 In retryable write that changes shard key value and owning shard, write concern failure results in non-WC error code
- Closed
- related to
-
SERVER-43712 Use RWCDefaults for incoming requests (mongos)
- Closed