diff --git a/server/raft.go b/server/raft.go index 3d57543fd96..dad6b902c21 100644 --- a/server/raft.go +++ b/server/raft.go @@ -3294,8 +3294,14 @@ func (n *raft) processAppendEntry(ae *appendEntry, sub *subscription) { n.debug("Term higher than ours and we are not a follower: %v, stepping down to %q", n.State(), ae.leader) n.stepdownLocked(ae.leader) } + } else if ae.term < n.term { + // ignore + n.debug("ignoring ae req from a leader with term %d which is less than ours") + return } + // FIX: we need to handle if term is less than ours as well, we should be ignoring the entry + // BUG: leader was being updated even if the leader's term was out of date (behind ours) if isNew && n.leader != ae.leader && n.State() == Follower { n.debug("AppendEntry updating leader to %q", ae.leader) n.updateLeader(ae.leader)