-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: add fast-path for ticking quiesced/dormant replicas #17617
storage: add fast-path for ticking quiesced/dormant replicas #17617
Conversation
@bdarnell If there are caveats to changing the Raft tick settings as is done by the first commit, I'll document the rationale behind the current settings thoroughly. |
I described the issues with changing the raft values in #17609 (comment). I don't think we've done any experimentation to show whether the coarser randomization of election timeouts makes a difference in practice. I'd rather just do the fast-path for now and leave the constants alone. Review status: 0 of 3 files reviewed at latest revision, 1 unresolved discussion, all commit checks successful. pkg/base/config.go, line 77 at r2 (raw file):
This change is backwards-incompatible for anyone who might have been using this environment variable. (Have we recommended this to anyone or have we just been using it internally? It was added in #15781) Comments from Reviewable |
} else if r.mu.quiescent { | ||
done = true | ||
if tickQuiesced { | ||
// NB: It is safe to call TickQuiesced without holding Replica.raftMu |
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.
You couldn't have two goroutines trying to tick the replica at the same time and thus clobber the counter in undefined ways?
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.
Ah, you hold the replica mu. Nevermind.
36f9837
to
48fe84d
Compare
Removed the first commit, leaving just the fast-path for ticking. Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions. pkg/base/config.go, line 77 at r2 (raw file): Previously, bdarnell (Ben Darnell) wrote…
Removed this commit from the PR. Comments from Reviewable |
48fe84d
to
a44aa8e
Compare
Reviewed 1 of 2 files at r2, 2 of 2 files at r3. pkg/storage/replica.go, line 3560 at r3 (raw file):
it's a shame that this same logic is in tickRaftMuLocked. pkg/storage/store.go, line 3593 at r3 (raw file):
nit: what's the point of binding while we're at it, it's perhaps slightly clearer as:
Comments from Reviewable |
Add fast-path for ticking quiesced/dormant replicas which avoids going through the Raft scheduler and avoids grabbing Replica.raftMu which can be held for significant periods of time. Fixes cockroachdb#17609
a44aa8e
to
2186866
Compare
Review status: 0 of 2 files reviewed at latest revision, 4 unresolved discussions, some commit checks pending. pkg/storage/replica.go, line 3560 at r3 (raw file): Previously, tamird (Tamir Duberstein) wrote…
I feel no shame about it. Trying to share the code seems more trouble than its worth (IMO). pkg/storage/store.go, line 3593 at r3 (raw file): Previously, tamird (Tamir Duberstein) wrote…
Done. Comments from Reviewable |
Add fast-path for ticking quiesced/dormant replicas which avoids going
through the Raft scheduler and avoids grabbing Replica.raftMu which can be
held for significant periods of time.
Fixes #17609