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

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Cluster Scalability
    • ALL
    • 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());
      

       
       

            Assignee:
            backlog-server-cluster-scalability [DO NOT USE] Backlog - Cluster Scalability
            Reporter:
            rachita.dhawan@mongodb.com Rachita Dhawan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: