Skip to content

Commit

Permalink
When the raft layer receives an index less than ours, if all else ok …
Browse files Browse the repository at this point in the history
…simply ack.

Signed-off-by: Derek Collison <[email protected]>
  • Loading branch information
derekcollison committed Nov 29, 2023
1 parent 5f74f59 commit 1c5383f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion server/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -3190,7 +3190,13 @@ func (n *raft) processAppendEntry(ae *appendEntry, sub *subscription) {

var success bool
if eae, _ := n.loadEntry(ae.pindex); eae == nil {
n.resetWAL()
// If terms are equal, and we are not catching up, we have simply already processed this message.
// So we will ACK back to the leader. This can happen on server restarts based on timings of snapshots.
if ae.pterm == n.pterm && !catchingUp {
success = true
} else {
n.resetWAL()
}
} else {
// If terms mismatched, or we got an error loading, delete that entry and all others past it.
// Make sure to cancel any catchups in progress.
Expand Down

0 comments on commit 1c5383f

Please sign in to comment.