The retried call to _commandExec() may cause a shard to return a NoSuchTransaction error response instead of its original StaleShardVersionError error response despite the router having been stale. Masking the original StaleConfig exception this way prevents the router from ever finding out it was stale. This behavior can lead a multi-statement transaction to perpetually be retried by the client and never succeed until the mongos refreshes for some other reason.
The calls to _commandExec() should be guarded by !opCtx->inMultiDocumentTransaction() similar to what was done for ShardCannotRefreshDueToLocksHeld.
- causes
-
SERVER-57434 Retry transaction on stale config error in read_concerns.js
- Closed
- is caused by
-
SERVER-28943 Make shards retry non-write commands on stale version exceptions
- Closed