-
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
raft: remove acceptReady from RawNode #130307
base: master
Are you sure you want to change the base?
Conversation
66f44f3
to
8c8c7bf
Compare
7a2650e
to
71eb886
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.
Thanks for the clean up!
The second commit is a little difficult to review - a lot moved and changed at the same time. It would likely have been helpful to split it up: one commit that moves acceptReady
right underneath readyWithoutAccept
, then a second commit that merges them with only minimal changes, then a third commit that does the simplifications that seem to have happened.
I've reviewed the new code but without checking that it's functionally identical to the previous one.
71eb886
to
2dead86
Compare
@tbg I split the last commit into 3 as you suggested. |
|
} | ||
} | ||
r.msgs = nil | ||
r.msgsAfterAppend = nil |
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.
Need to double-check that this field is handled equivalently. Previously it was cleared between readyWithoutAccept
and acceptReady
, now (in the merged code) it is cleared at the end.
Hmm, seems too suspiciously related. I'll also take a look tmrw. |
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.
Looks good to me - approving from a review point of view after your pending comments are addressed.
The test failure is suspicious.
Actually, pattern matching suggests that a flake like this makes some sense. Previously |
The test is inherently flaky. In this bit cockroach/pkg/raft/node_test.go Lines 926 to 950 in 7571549
Normally, the "drain" loop will see at least one
but we see
That can happen if the "drain" loop gives up too fast (it allows only 10ms). I changed the timeout to 1 microsecond locally, and it reproes the thing (both on |
2dead86
to
673e92f
Compare
Deflaked the test in this PR, for convenience. |
Will sequence this PR after #131746, so that tweaking the |
Epic: none Release note: none
Epic: none Release note: none
Epic: none Release note: none
673e92f
to
c761205
Compare
This PR removes the possibility of getting
Ready
fromRawNode
and not accepting it. This API existed to serve concurrency concerns in the implementation ofNode
interface, which was removed in #131746.Removing the "accept" phase from
RawNode
allows further cleanups in the supporting data structures (raftLog
/unstable
/ etc) down the stack.Conceptually, we do want separation between "get ready" and "accept ready", but in a different form:
HasReady()
method or its variants (specific to a part ofRawNode
, like the log storage). Today it only returns one "overall" bit.LogSnapshot()
andSendMsgApp()
. Today, theReady()
still returns all the work eagerly.Related to #122131