-
Notifications
You must be signed in to change notification settings - Fork 168
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
Do not reset the electionElapsed if the node doesn't grant vote #167
base: main
Are you sure you want to change the base?
Conversation
ahrtr
commented
Feb 20, 2024
•
edited
Loading
edited
0a28298
to
00f5d2e
Compare
c9af84c
to
e0f4b39
Compare
d1301de
to
1744073
Compare
cc @pav-kv @erikgrinaker PTAL |
I assume the motivation of this change comes from etcd-io/etcd#17455. However, there might be a potential side effect if we don't reset election timeout. When such a node does not reset its election timeout, it may quickly start a new campaign and makes the winning candidate step down to follower again before it becomes leader. It can be even worse if the node cannot win election (for example, it does not have sufficient connections to other nodes due to network issue). Then the node may keep stopping other candidates from becoming leader. |
Yes.
This PR doesn't change the local node's frequency to campaign. The PR just prevents any node being affected by other unqualified candidate.
|
If the local node receives a MsgVote message with higher term but it doesn't grant the vote; it turns into a follower, but it shouldn't reset the electionElapsed, to ensure it has higher priority to start a campaign in the next round of election. If we reject a node, it's highly likely we will reject it again if it immediately campaigns again. So it may waste a long time to elect a leader if we reset the electionElapsed. Signed-off-by: Benjamin Wang <[email protected]>
1744073
to
2299701
Compare
Prefer to the alternative PR #169,
|
Why does it conceptually need to reset the timeout? The timeout behaviours are heuristics, so there is no right or wrong ways. We should consider behaviours and do some calculations to compare heuristics. Do we need to reset |
YES, it's one of the reasons why I prefer to #169. The other reason is #169 has better readability.
All election time parameters (e.g. |