-
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
kvserver: load committed entries after mu.Unlock() #143689
base: master
Are you sure you want to change the base?
Conversation
It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR? 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
@tbg Would you be interested in measuring the impact of this on #140235? Or give me a hint how to do it. A conjecture is that it should have some impact because all these entries are not in |
64759f3
to
79a69b5
Compare
79a69b5
to
60dc887
Compare
This commit makes handleRaftReadyRaftMuLocked load the Ready.Committed entries after releasing Replica.mu, while still holding Replica.raftMu. This ensures that we don't have this IO under Replica.mu. This also fixes a bug. Previously, detachRaftEntriesMonitorRaftMuLocked would be called too soon, after Ready has been generated. Instead, it should span the entire Ready handling scope, so that includes the scope of applying the entries to the state machine. Epic: none Release note: none
60dc887
to
a630095
Compare
|
||
logRaftReady(ctx, rd) | ||
outboundMsgs, msgStorageAppend = splitLocalStorageMsgs(rd.Messages) | ||
ready = raftGroup.Ready() |
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.
There are a bunch of redundant checks between HasReady()
and Ready()
calls. We could further squash this in the future as:
ready, hasReady = raftGroup.Ready()
This commit makes
handleRaftReadyRaftMuLocked
load theReady.Committed
entries after releasingReplica.mu
, while still holdingReplica.raftMu
. This ensures that we don't have this IO underReplica.mu
. Also, this storage interaction is placed afterr.sendRaftMessages
, which reduces messaging latency.This also fixes two bugs.
detachRaftEntriesMonitorRaftMuLocked
would be called too soon, afterReady
has been generated. Instead, it should span the entireReady
handling scope, so that includes the scope of applying the entries to the state machine.raftMu.bytesAccount
was unsafe to refer under onlyReplica.mu
.Part of #140235
Related to #143652, #143615
Obsoletes #125842