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

Support configuring election timeout range #63

Merged
merged 6 commits into from
May 20, 2018
Merged

Conversation

BusyJay
Copy link
Member

@BusyJay BusyJay commented May 19, 2018

Sometimes, a node is expected to take less chance to become a leader due to reasons like poor performance. We can make it happen by customizing the randomized election timeout.

src/raft.rs Outdated
/// to become leader. This configuration ensures that the randomized election_timeout
/// will always be suit in [min_election_tick, max_election_tick).
/// If it is None, then election_tick will be chosen.
pub min_election_tick: Option<usize>,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can remove Option here, you can set min to election timeout and max to 2 x election timeout explicitly if they are 0 at initialization.

@siddontang
Copy link
Contributor

LGTM

But CI failed.

@BusyJay
Copy link
Member Author

BusyJay commented May 20, 2018

PTAL

@hicqu
Copy link
Contributor

hicqu commented May 20, 2018

LGTM.

@BusyJay BusyJay merged commit 8e368c1 into master May 20, 2018
@BusyJay BusyJay deleted the add-least-timeout branch May 20, 2018 15:09
@Hoverbear Hoverbear added this to the 0.3.0 milestone Jul 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants