Details
-
Bug
-
Resolution: Unresolved
-
Major - P3
-
None
-
None
-
None
-
Cluster Scalability
-
ALL
-
4
-
3
Description
This test runs a single-write-shard transaction which commits, but for which the client retries commit and a read-only shard fails over before the second commit attempt.
The issue here is the readOnly shard has 2 replicas, the test steps down the primary and doesn't ensure that a primary is re-elected before reattempting a second commit. This specific scenario where the Replica Set hasn't elected a primary yet throws a 'Could find host matching Primary state'.
Suggested fix: Ensure a primary re-election occurs before re-attempting the re-commit. And ensure that secondary is elected as primary now.
jsTest.log("Induce a failover on the read shard."); |
assert.commandWorked(st.rs0.getPrimary().adminCommand({replSetStepDown: 60, force: true})); |
jsTest.log("Make second attempt to commit, should still return that the transaction committed"); |
assert.commandWorked(session.commitTransaction_forTesting()); |
