-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
storage: simplify campaigning logic after PreVote is enabled #18365
Comments
The delayed campaigning is not just to prevent disruption to the existing leader, it also avoids sending |
Yeah, we wouldn't want to campaign at startup. I wasn't proposing to get rid of the lazy Raft loading. My proposal is to get rid of the logic for deciding whether to campaign a dormant replica when some operation is being performed and instead always campaign such replicas. |
Fold the necessary checks into withRaftGroupLocked and remove unnecessary arguments. This has the effect of campaigning somewhat more than before but that's OK since PreVote minimizes the disruption. Fixes cockroachdb#18365 Release note: None
Fold the necessary checks into withRaftGroupLocked and remove unnecessary arguments. This has the effect of campaigning somewhat more than before but that's OK since PreVote minimizes the disruption. Fixes cockroachdb#18365 Release note: None
Fold the necessary checks into withRaftGroupLocked and remove unnecessary arguments. This has the effect of campaigning somewhat more than before but that's OK since PreVote minimizes the disruption. Fixes cockroachdb#18365 Release note: None
24920: storage: Simplify raft automatic campaigning after PreVote r=bdarnell a=bdarnell Before we implemented PreVote, we had various heuristics to decide when we should ask raft to campaign (bypassing the usual timeout). Since PreVote has reduced the cost of raft elections (by ensuring that a node that calls for an election it can't win doesn't disrupt its peers), we can get by with simpler logic. In addition to simplifying the logic, this PR introduces a new campaign trigger when a range unquiesces. This is a prerequisite for getting rid of the TickQuiesced hack (which is disabled by default in this PR and will be removed in a future one). Fixes #18365 Co-authored-by: Ben Darnell <[email protected]>
I recently began seeing very high latencies (orders of magnitude larger than expected) when running I ran some request tracing and found a common theme between each of the slow SQL queries. They each contain a number of KV operations that all look like: Notice that a lease request is being retried multiple times because of I was not seeing this on
Is it possible that this assumption is incorrect? This issue and the resulting change was formed on the idea that:
What is the effect when there is not already a Raft leader? Is it possible that this change could slow down leader elections if multiple replicas attempt to become a leader at the same time when one does not yet exist? |
I'm looking at this now for #26391. The biggest issue is that when a MsgVote arrives, we wake up and campaign before processing the message, causing the initial election to fail, requiring a timeout for the next election. I've fixed that although I'm still seeing some slowness in elections that I'm trying to investigate.
Yes, that's a risk. It's always been the case, although this commit might have increased the chances somewhat. My assumption is that the wakeup events are unlikely to hit multiple replicas simultaneously. |
With PreVote, campaigning is disruptive to a range that currently has a leader because it forces a Raft election. But after splits and to speed up tests we want to elect a Raft leader for a range quickly. So we've added various hacks to eagerly campaign replicas (e.g. the leaseholder of a dormant replica will campaign upon creating its Raft group). When PreVote is enabled it seems feasible to eliminate these hacks and simply always campaign when a replica initializes its Raft group. The PreVote mechanism should prevent any disruption if there is already a Raft leader.
@bdarnell Am I missing anything here that would require the existing campaigning logic once PreVote is enabled?
The text was updated successfully, but these errors were encountered: