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

IGNITE-15705 election timeout autoadjusting mechanism #481

Closed
wants to merge 15 commits into from

Conversation

alievmirza
Copy link
Contributor

@alievmirza alievmirza commented Nov 30, 2021

@alievmirza alievmirza force-pushed the ignite-15705 branch 3 times, most recently from bd11072 to 26a4e1e Compare December 9, 2021 07:21
@alievmirza alievmirza changed the title IGNITE-15705 WIP IGNITE-15705 election timeout autoadjusting mechanism Dec 28, 2021
private static final int DEFAULT_TIMEOUT_MS_MAX = 11_000;

/** Default max number of a round after which timeout will be adjusted. */
public static final long DEFAULT_ROUNDS_WITHOUT_ADJUSTING = 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this public ?

private long roundsWithoutAdjusting = DEFAULT_ROUNDS_WITHOUT_ADJUSTING;

public ExponentialBackoffTimeoutStrategy() {

Copy link
Contributor

Choose a reason for hiding this comment

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

call to this with defaults is missing

long timeout = options.getElectionTimeoutStrategy().nextTimeout(options.getElectionTimeoutMs(), electionRound);

if (timeout != options.getElectionTimeoutMs()) {
LOG.info("Election timeout was adjusted according to {} ", options.getElectionTimeoutStrategy().toString());
Copy link
Contributor

Choose a reason for hiding this comment

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

toString is not needed

LOG.info("Election timeout was adjusted according to {} ", options.getElectionTimeoutStrategy().toString());
resetElectionTimeoutMs((int) timeout);
electionAdjusted = true;
electionRound = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we reset electionRound to zero after each succesful adjustment ?
It doesn't seem correct to me. Additionally, I would log this value on each election attempt

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought that we could use the logic with several election attempts without adjusting also after the moment when the timeout was adjusted. Motivation is to postpone a moment when we reach the maximum election timeout.

Seems, that logic without resetting is more clear, I'll revert this change.

@asfgit asfgit closed this in f51281b Jan 26, 2022
ygerzhedovich pushed a commit that referenced this pull request Feb 23, 2024
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.

2 participants