"stepCandidate" should reuse candidate's own term, not term in Message, because pre-vote is requested with future term. Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
@@ -1148,6 +1148,8 @@ func stepCandidate(r *raft, m pb.Message) error {
r.bcastAppend()
}
case len(r.votes) - gr:
+ // pb.MsgPreVoteResp contains future term of pre-candidate
+ // m.Term > r.Term; reuse r.Term
r.becomeFollower(r.Term, None)
case pb.MsgTimeoutNow: