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

Nodes should update their own term from the term in heartbeats

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Replication
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      (function() {
          "use strict";
          var replTest = new ReplSetTest({name: 'testSet', nodes: 2});
       
          replTest.startSet();
          replTest.initiate();
       
          var primary = replTest.getPrimary();
          var secondary = replTest.getSecondary();
       
          printjson(primary.getDB("admin").runCommand({replSetGetStatus: 1}));
          jsTestLog("Sending in heartbeat");
          printjson(assert.commandWorked(primary.getDB("admin").runCommand({ replSetHeartbeat: "testSet", configVersion: 1, from: secondary.host, fromId: 1, term: 200 })));
          printjson(primary.getDB("admin").runCommand({replSetGetStatus: 1}));
          replTest.waitForState(replTest.nodes[0], ReplSetTest.State.SECONDARY);
      })();
      

      Show
      (function() { "use strict"; var replTest = new ReplSetTest({name: 'testSet', nodes: 2});   replTest.startSet(); replTest.initiate();   var primary = replTest.getPrimary(); var secondary = replTest.getSecondary();   printjson(primary.getDB("admin").runCommand({replSetGetStatus: 1})); jsTestLog("Sending in heartbeat"); printjson(assert.commandWorked(primary.getDB("admin").runCommand({ replSetHeartbeat: "testSet", configVersion: 1, from: secondary.host, fromId: 1, term: 200 }))); printjson(primary.getDB("admin").runCommand({replSetGetStatus: 1})); replTest.waitForState(replTest.nodes[0], ReplSetTest.State.SECONDARY); })();

      Description

      Heartbeats send a term with them, and when the primary receives a term higher than it's own, it should step down. All nodes should update their own term when they see a higher term than their own. Nodes do not currently look at the term in heartbeats and consequently, primaries do not step down when they see higher terms.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-server-repl Backlog - Replication Team
              Reporter:
              judah.schvimer Judah Schvimer
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: