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

upgradePrimary should call awaitNodesAgreeOnPrimary() before it gets the primary

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.5.7
    • Affects Version/s: None
    • Component/s: Replication
    • None
    • Fully Compatible
    • ALL
    • Repl 2017-05-08
    • 0

      getPrimary() gets the primary, but does not wait for the primary to be "stable". If two nodes decide to run for primary around the same time, they could both win in quick succession, and the first getPrimary() could return the first winner and the second getPrimary() could return the second winner. awaitNodesAgreeOnPrimary() is designed for precisely this situation, waiting for the nodes to agree on a primary to avoid this race.

          let oldPrimary = this.stepdown(primary);
          primary = this.getPrimary();
      
          this.upgradeNode(oldPrimary, options, user, pwd);
      
          let newPrimary = this.getPrimary();
      
          if (noDowntimePossible)
              assert.eq(newPrimary, primary);
      

            Assignee:
            spencer@mongodb.com Spencer Brody (Inactive)
            Reporter:
            judah.schvimer@mongodb.com Judah Schvimer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: