From e5625b9d9b6870518e84a0a1ec2bc0b718b5bd59 Mon Sep 17 00:00:00 2001 From: Derek Collison Date: Fri, 25 Aug 2023 10:15:01 -0700 Subject: [PATCH] If a leader is asked for an item and we have no items left, make sure to also step-down. Signed-off-by: Derek Collison --- server/raft.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/raft.go b/server/raft.go index daf5493a38..bee20a1fcd 100644 --- a/server/raft.go +++ b/server/raft.go @@ -2509,6 +2509,10 @@ func (n *raft) catchupFollower(ar *appendEntryResponse) { } if err != nil || ae == nil { n.warn("Could not find a starting entry for catchup request: %v", err) + // If we are here we are seeing a request for an item we do not have, meaning we should stepdown. + // This is possible on a reset of our WAL but the other side has a snapshot already. + // If we do not stepdown this can cycle. + n.stepdown.push(noLeader) n.Unlock() arPool.Put(ar) return