Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-66847

txn_single_write_shard_failover.js should wait for primary re-election before retrying commitTransaction

    • Cluster Scalability
    • Fully Compatible
    • ALL
    • Cluster Scalability 2024-6-10, Cluster Scalability 06/24/24
    • 4
    • 3

      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());
      

       
       

        1. image-2022-05-27-14-06-52-343.png
          376 kB
          Rachita Dhawan
        2. image-2022-05-27-14-05-17-859.png
          376 kB
          Rachita Dhawan

            Assignee:
            grant.xiao@mongodb.com Grant Xiao (Inactive)
            Reporter:
            rachita.dhawan@mongodb.com Rachita Dhawan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: