-
Notifications
You must be signed in to change notification settings - Fork 592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not request votes if term changed in prevote phase #18394
Do not request votes if term changed in prevote phase #18394
Conversation
9c5adf4
to
2891cf2
Compare
ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/48944#018f63af-8550-485b-8694-805474ef15c4 ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/48944#018f63af-854d-46c0-b9d0-a32045246723 ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/48944#018f63ce-bde0-4a42-a863-f82dfc0264e7 ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/48944#018f63ce-bde7-4438-bcfe-7d1dc676419a ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/48944#018f63ce-bde2-4fe3-bd1e-1d9a5d169d8b ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/48944#018f63ce-bde5-4586-80fe-087778e7016a ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/48985#018f723e-856e-4b5c-8fb4-e4deaad8ded9 ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/49079#018f75f3-820d-44ca-8232-e8fd5b3ee40e |
2891cf2
to
44b9efd
Compare
ci failure: #13275 |
src/v/raft/vote_stm.h
Outdated
@@ -84,6 +88,10 @@ class vote_stm { | |||
} | |||
|
|||
if (value->has_value()) { | |||
if (value->value().term != _vote_stm._req.term) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if !=
should be >
? Or is <
impossible because the other side will always update its term?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exactly, it is impossible in geral we should never treat replies coming from different ter as succesfull
In vote stm we didn't mark the vote replies with greater term as not granted votes. This may lead to unnecessary leader elections and longer recovery after failures. Change the logic in `vote_stm` to explicitly mark vote responses with greater term as failed. Signed-off-by: Michał Maślanka <michal@redpanda.com>
phases If term changed between pre-vote and actual vote phase a candidate should not proceed and request votes. Signed-off-by: Michał Maślanka <michal@redpanda.com>
Added more logging about the start and result of pre-vote election. Signed-off-by: Michał Maślanka <michal@redpanda.com>
be4d32e
to
1f0203f
Compare
/backport v24.1.x |
/backport v23.3.x |
Failed to create a backport PR to v23.3.x branch. I tried:
|
Failed to create a backport PR to v24.1.x branch. I tried:
|
In vote stm we didn't mark the vote replies with greater term as not granted votes. This may lead to unnecessary leader elections and longer recovery after failures. Change the logic in
vote_stm
to explicitly mark vote responses with greater term as failed. Additional check was added in consensus to recognise if a candidate state changed in between the pre-vote and vote phase.Backports Required
Release Notes
Improvements