From 3b02d4c5ffe739fa48b2e109d39e18f6d5a7609d Mon Sep 17 00:00:00 2001 From: Tobias Schottdorf Date: Fri, 26 Jul 2019 23:19:34 +0200 Subject: [PATCH] raft: leave TODO about leaving StateSnapshot The condition is overly strict, which has popped up in CockroachDB recently. --- raft/raft.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/raft/raft.go b/raft/raft.go index bc6b4a126..832bff368 100644 --- a/raft/raft.go +++ b/raft/raft.go @@ -1093,6 +1093,9 @@ func stepLeader(r *raft, m pb.Message) error { case pr.State == tracker.StateProbe: pr.BecomeReplicate() case pr.State == tracker.StateSnapshot && pr.Match >= pr.PendingSnapshot: + // TODO(tbg): we should also enter this branch if a snapshot is + // received that is below pr.PendingSnapshot but which makes it + // possible to use the log again. r.logger.Debugf("%x recovered from needing snapshot, resumed sending replication messages to %x [%s]", r.id, m.From, pr) // Transition back to replicating state via probing state // (which takes the snapshot into account). If we didn't