[SERVER-26746] Nodes should update their own term from the term in heartbeats Created: 24/Oct/16  Updated: 06/Dec/22  Resolved: 09/Apr/20

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Judah Schvimer Assignee: Backlog - Replication Team
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-29030 Announce new primary via heartbeat re... Closed
Related
related to SERVER-28290 stepping down due to a higher term se... Closed
related to SERVER-26990 Unify tracking of secondary state bet... Closed
Assigned Teams:
Replication
Operating System: ALL
Steps To Reproduce:

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

Participants:

 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.



 Comments   
Comment by Siyuan Zhou [ 09/Apr/20 ]

It's great that this has a repro. I believe this is addressing the same issue as inĀ SERVER-29030. Closing as a dup.

Generated at Thu Feb 08 04:13:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.