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

Nodes should update their own term from the term in heartbeats

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Replication
    • None
    • Replication
    • ALL
    • 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

        Activity

          People

            backlog-server-repl Backlog - Replication Team
            judah.schvimer@mongodb.com Judah Schvimer
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: