raft: check VotersOutgoing for snapshot

Close #12631.

Signed-off-by: Jay Lee <BusyJayLee@gmail.com>
This commit is contained in:
Jay Lee 2021-01-21 16:09:37 +08:00
parent f85b08c735
commit f947c815d0
No known key found for this signature in database
GPG Key ID: CF3437B6A06C22F9

View File

@ -1412,6 +1412,9 @@ func (r *raft) restore(s pb.Snapshot) bool {
for _, set := range [][]uint64{
cs.Voters,
cs.Learners,
cs.VotersOutgoing,
// `LearnersNext` doesn't need to be checked. According to the rules, if a peer in
// `LearnersNext`, it has to be in `VotersOutgoing`.
} {
for _, id := range set {
if id == r.id {