mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-29 11:10:40 +00:00
raft: fix vote reply handling in prevote
Do not register a reply to prevote as a real vote Found and authored by @kostja. Signed-off-by: Alejo Sanchez <alejo.sanchez@scylladb.com> Message-Id: <20210604122530.1975388-1-alejo.sanchez@scylladb.com>
This commit is contained in:
committed by
Avi Kivity
parent
50d64646cd
commit
bd168d57ff
@@ -692,6 +692,10 @@ void fsm::request_vote_reply(server_id from, vote_reply&& reply) {
|
||||
logger.trace("{} received a {} vote from {}", _my_id, reply.vote_granted ? "yes" : "no", from);
|
||||
|
||||
auto& state = std::get<candidate>(_state);
|
||||
// Should not register a reply to prevote as a real vote
|
||||
if (state.is_prevote != reply.is_prevote) {
|
||||
return;
|
||||
}
|
||||
state.votes.register_vote(from, reply.vote_granted);
|
||||
|
||||
switch (state.votes.tally_votes()) {
|
||||
|
||||
Reference in New Issue
Block a user