Skip to content
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

Raft vote process unification #16847

Merged
merged 5 commits into from
Mar 13, 2024

Conversation

mmaslankaprv
Copy link
Member

raft::prevote_stm was basically a copy of raft::vote_stm without few
parts. Removed the prevote_stm and made vote_stm handling both
cases.

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v23.3.x
  • v23.2.x

Release Notes

  • none

@mmaslankaprv
Copy link
Member Author

/dt

@mmaslankaprv
Copy link
Member Author

/dt

@mmaslankaprv
Copy link
Member Author

/dt

@mmaslankaprv mmaslankaprv marked this pull request as ready for review March 5, 2024 11:40
@vbotbuildovich
Copy link
Collaborator

new failures in https://buildkite.com/redpanda/redpanda/builds/45694#018e0ec5-7114-4153-b564-00203f4f0997:

"rptest.tests.controller_availability_test.ControllerAvailabilityTest.test_controller_availability_with_nodes_down.cluster_size=5.stop=minority"

Signed-off-by: Michal Maslanka <michal@redpanda.com>
`raft::prevote_stm` is basically a copy of `raft::vote_stm` without few
parts. Changed the `raft::vote_stm` to handle both the pre-vote and
actual vote phases. The changes are rather cosmetic and only skip some
parts when working in pre-voting mode.

Signed-off-by: Michal Maslanka <michal@redpanda.com>
Since pre-voting is now handled by `vote_stm` the prevote stm can be
completely removed.

Signed-off-by: Michal Maslanka <michal@redpanda.com>
Refactored stream output operators of raft types to use `fmt` library.
Previously the string representation of Raft types was inconsistent
(missing white spaces, commas etc).

Signed-off-by: Michal Maslanka <michal@redpanda.com>
Previously `prevote_stm` was incorrectly calculating timeout value
leading to usage of very large timeout. Adjusted the default timeout of
vote_stm to make leader election less prone to network delays and system load
fluctuations.

Signed-off-by: Michal Maslanka <michal@redpanda.com>
Copy link
Contributor

@bharathv bharathv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, one question.

@@ -49,9 +50,13 @@ vote_stm::~vote_stm() {
"Must call vote_stm::wait()");
}
ss::future<result<vote_reply>> vote_stm::do_dispatch_one(vnode n) {
auto tout = _ptr->_jit.base_duration();
auto tout = _ptr->_jit.base_duration() * 3;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't understand the "* 3" part, whats special about 3?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i just use a timeout that is 3 time greater than the election timeout, not to introduce an additional parameter.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mmaslankaprv wondeirng if jit should have a method base_duration_with_multiplier(3) or smth like that.

@emaxerrno
Copy link
Contributor

this is neat.

@mmaslankaprv mmaslankaprv merged commit 92ad32b into redpanda-data:dev Mar 13, 2024
16 checks passed
@mmaslankaprv mmaslankaprv deleted the raft-vote-improvements branch March 13, 2024 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants