-
Notifications
You must be signed in to change notification settings - Fork 589
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
Added detection of the node with longest log during leader election process #17915
Conversation
/dt |
2629696
to
cb8a3f5
Compare
/dt |
cb8a3f5
to
27f8bd5
Compare
/dt |
src/v/raft/vote_stm.cc
Outdated
return with_gate( | ||
_vote_bg, | ||
[this] { | ||
return _sem.wait(_ptr->_jit.base_duration(), 1); |
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.
we can only wait for
(_requests_dispatched_ts + _ptr->_jit.base_duration() - clock_type::now()) ?
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 think it depends, the vote_request
timeout is larger than the election timeout, indeed i can adjust wait timeout here to be dependent from the dispatch timestamp
Signed-off-by: Michał Maślanka <michal@redpanda.com>
Signed-off-by: Michał Maślanka <michal@redpanda.com>
Signed-off-by: Michał Maślanka <michal@redpanda.com>
27f8bd5
to
659649b
Compare
d274239
to
ea08cb6
Compare
Signed-off-by: Michał Maślanka <michal@redpanda.com>
ea08cb6
to
fc667cc
Compare
ci failure: #17847 |
Making Raft leader election unsuccessful if one of the votes has log which is more up to data than the current candidate. This solution will allow us to minimise the data loss risk when using relaxed consistency writes. With the optimisation included in this PR a candidate will wait up to election timeout for the replies from all of the nodes and will fail the leader election if any of the voters log is more up to date. The solution included in this PR favour the nodes with longest log to become a leader without compromising availability as it is still enough for the majority to vote for the candidate for it to become a leader.
Another way of seeing this solution is that the candidate will use information about voter logs if they are available instead of ignoring the one with longest log and moving on with the majority based decision.
The detection mechanism can be controller in runtime with
raft_enable_longest_log_detection
cluster configuration flag.Backports Required
Release Notes
Improvements