-
Notifications
You must be signed in to change notification settings - Fork 579
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 config update fix #364
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -293,8 +293,15 @@ consensus::success_reply consensus::update_follower_index( | |
|
||
void consensus::maybe_promote_to_voter(model::node_id id) { | ||
(void)ss::with_gate(_bg, [this, id] { | ||
const auto& latest_cfg = _configuration_manager.get_latest(); | ||
|
||
// node is no longer part of current configuration, skip promotion | ||
if (!latest_cfg.current_config().contains(id)) { | ||
return ss::now(); | ||
} | ||
|
||
// is voter already | ||
if (config().is_voter(id)) { | ||
if (latest_cfg.is_voter(id)) { | ||
return ss::now(); | ||
} | ||
auto it = _fstats.find(id); | ||
|
@@ -493,8 +500,6 @@ bool consensus::should_skip_vote(bool ignore_heartbeat) { | |
} | ||
|
||
skip_vote |= _vstate == vote_state::leader; // already a leader | ||
skip_vote |= !_configuration_manager.get_latest().is_voter( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this change mean that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. non-voters were always allow to cast a vote but not to request a vote. This behavior didn't change |
||
_self); // not a voter | ||
|
||
return skip_vote; | ||
} | ||
|
@@ -543,6 +548,12 @@ void consensus::dispatch_vote(bool leadership_transfer) { | |
// update target priority | ||
_target_priority = next_target_priority(); | ||
|
||
// skip sending vote request if current node is not a voter | ||
if (!_configuration_manager.get_latest().is_voter(_self)) { | ||
arm_vote_timeout(); | ||
return; | ||
} | ||
|
||
// if priority is to low, skip dispatching votes, do not take priority into | ||
// account when we transfer leadership | ||
if (current_priority_to_low && !leadership_transfer) { | ||
|
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.
if it is possible that
maybe_promote_to_voter
is called for a node id that is already a voter, is it possible that it is called for a node id that is already a voter and is also not in the current configuration? would that need a special case like demotion to candidate?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.
What do you mean by demotion to
candidate
?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.
looking back at this i don't think i have the same question now. i must have be confused about the combination of conditions.