-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
NRG: Don't switch to candidate when waiting for pending applies #6056
NRG: Don't switch to candidate when waiting for pending applies #6056
Conversation
474a4b5
to
943d20d
Compare
943d20d
to
3bc1227
Compare
3bc1227
to
61c6c59
Compare
Let me know when ready for review. |
Maurice and I have been on Zoom talking about this change and we've come up with a cleaner fix, so will be posting an update soon. Will let you know when ready for review. |
61c6c59
to
c3e65f2
Compare
3eb4281
to
be280f0
Compare
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
be280f0
to
7af96d8
Compare
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.
LGTM
@derekcollison This one is ready for review now! |
if n.observer || n.paused { | ||
// Avoid petitioning to become leader if we're behind on applies. | ||
if n.observer || n.paused || n.applied < n.commit { | ||
n.resetElect(minElectionTimeout / 4) |
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.
Why the div 4?
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.
Don't want to slow down the potential for an election too much, so this ends up being 1 second in normal operation instead of 4 to 9 seconds. Divide because then it speeds up in the unit tests along with all the other consts.
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.
ok
A follower could become candidate/leader before processing a snapshot. Based on timing the snapshot could enter into the apply queue, and before
n.PauseApply()
is called the follower could freely become leader and then fail processing the snapshot.When a snapshot is not successfully applied yet, block the follower from becoming candidate until the snapshot is processed.
Signed-off-by: Maurice van Veen github@mauricevanveen.com