Skip to content

Commit

Permalink
AE req logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ReubenMathew committed Jul 15, 2024
1 parent 0ba71f3 commit c9d93a2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions server/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -3173,6 +3173,7 @@ func (n *raft) updateLeader(newLeader string) {
// to be committed.
func (n *raft) processAppendEntry(ae *appendEntry, sub *subscription) {
n.Lock()

// Don't reset here if we have been asked to assume leader position.
if !n.lxfer {
n.resetElectionTimeout()
Expand All @@ -3184,13 +3185,17 @@ func (n *raft) processAppendEntry(ae *appendEntry, sub *subscription) {
return
}

// ignore
if ae.term < n.term {
// ignore
n.debug("ignoring ae req from a leader with term %d which is less than ours", ae.term)
n.debug("ignoring ae req from a leader (%s) with term %d which is less than ours", ae.leader, ae.term)
n.Unlock()
return
}

// log what append entry we got
n.debug("AE from %s (term:%d, commit: %d, pterm: %d, pindex: %d) with %d entries", ae.leader, ae.term, ae.commit, ae.pterm, ae.pindex, len(ae.entries))


// Scratch buffer for responses.
var scratch [appendEntryResponseLen]byte
arbuf := scratch[:]
Expand Down

0 comments on commit c9d93a2

Please sign in to comment.