-
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: evaluate proposals without lock #10012
Conversation
324433d
to
1a01c28
Compare
Reviewed 5 of 5 files at r1. pkg/storage/replica.go, line 1597 at r1 (raw file):
To be clear, it's no longer synchronized by Replica.mu, but it should only be called from the scheduler (which acts as a kind of mutex), right? pkg/storage/replica.go, line 1682 at r1 (raw file):
Missing pkg/storage/replica.go, line 2302 at r1 (raw file):
Are these warnings temporary? pkg/storage/replica.go, line 2313 at r1 (raw file):
These names are (still) really difficult to remember/distinguish. Does the move to proposer-evaluated KV suggest any better names? For example, could we now s/refurbish/reevaluate/? pkg/storage/replica.go, line 2316 at r1 (raw file):
Proposer-evaluated KV makes it much more expensive to refresh a command, so we may need to be more conservative about how often we do it. pkg/storage/replica.go, line 2361 at r1 (raw file):
This will be fixed as a part of this PR, right? pkg/storage/replica.go, line 2370 at r1 (raw file):
This reverses the order of repropsals and refurbishments. Why? pkg/storage/replica.go, line 2671 at r1 (raw file):
"bend"? pkg/storage/replica.go, line 2688 at r1 (raw file):
Include more context in this error message (or silently drop it? Does it matter that we give up on refurbishments during shutdown?) Comments from Reviewable |
Review status: all files reviewed at latest revision, 11 unresolved discussions, some commit checks failed. pkg/storage/replica.go, line 1597 at r1 (raw file):
|
1a01c28
to
16c896e
Compare
Review status: all files reviewed at latest revision, 11 unresolved discussions, some commit checks failed. pkg/storage/replica.go, line 1597 at r1 (raw file):
|
Review status: 0 of 49 files reviewed at latest revision, 11 unresolved discussions, some commit checks failed. pkg/storage/replica.go, line 2302 at r1 (raw file):
|
Addressed most comments, but some discussion remains. I changed the base branch of this PR, so please excuse the weird diffs Reviewable might throw at you. Review status: 3 of 5 files reviewed at latest revision, 11 unresolved discussions, some commit checks pending. Comments from Reviewable |
Review status: 3 of 5 files reviewed at latest revision, 11 unresolved discussions, all commit checks successful. pkg/storage/replica.go, line 1597 at r1 (raw file):
|
b2d3e64
to
50770af
Compare
Review status: 1 of 5 files reviewed at latest revision, 12 unresolved discussions. pkg/storage/replica.go, line 1597 at r1 (raw file):
Done (
This is documented inside of
On your other question:
Nothing there should have changed. Two commands which are in flight (i.e. past command queue) concurrently should not be able to influence each other. Of course that is one of the big assumptions that we should thoroughly try to poke holes into. pkg/storage/replica.go, line 2043 at r1 (raw file):
Pinged you from a comment there. Could you get back to me on this:
It's my biggest concern right now. Doesn't seem right to use the scheduler. pkg/storage/replica.go, line 2687 at r2 (raw file):
@petermattis this one does part of the work that Comments from Reviewable |
Reviewed 4 of 4 files at r3. pkg/storage/replica.go, line 1597 at r1 (raw file):
|
Review status: all files reviewed at latest revision, 13 unresolved discussions, some commit checks failed. pkg/storage/replica.go, line 2043 at r1 (raw file):
|
I want to get #10131 in first. It will remove some of the complications here. |
50770af
to
94cc2b7
Compare
PTAL at the new changes (fair bit of churn between the revisions due to reworking this after #10131, perhaps just review from scratch). Review status: 0 of 2 files reviewed at latest revision, 13 unresolved discussions, some commit checks pending. pkg/storage/replica.go, line 2043 at r1 (raw file):
|
94cc2b7
to
d5beaf3
Compare
Have you run Review status: 0 of 2 files reviewed at latest revision, 9 unresolved discussions, all commit checks successful. pkg/storage/replica.go, line 294 at r4 (raw file):
Did you audit the code to make sure this is true? pkg/storage/replica.go, line 296 at r4 (raw file):
Is this pkg/storage/replica.go, line 1743 at r4 (raw file):
I'd rephrase this to say that holding Comments from Reviewable |
9d153b7
to
856485c
Compare
TFTR. Review status: 0 of 2 files reviewed at latest revision, 9 unresolved discussions, all commit checks successful. pkg/storage/replica.go, line 294 at r4 (raw file):
|
Did get some stress failures, but nothing that seems related:
The latter is tracked in #10166, but I'll have to double check on the former. |
Indeed seems newly flaky:
(ran on master for >9min) I'll take a look tomorrow. |
The main objective of this change is to (later) enable proposer-evaluated KV to compute the `WriteBatch` when evaluating a proposal (i.e. when turning a `BatchRequest` into a `*ProposalData`). The previous code assumes making a proposal is cheap, and thus it is done under a large critical sections. MaxLeaseIndex is assigned at the latest possible moment before submitting to Raft. Multiple inbound requests can pass the command queue without interacting, and it's important to assign the Lease index only right before when the proposal is submitted to Raft. Note that the command queue currently doesn't cover all the data accessed by Raft commands (cockroachdb#10084) and that a discussion of how precisely command evaluation will work is still being discussed (cockroachdb#6290). Nevertheless, this change should be safe and a step in the right direction.
856485c
to
41526e2
Compare
Upon further testing, it's also flaky on master. Filed #10198. |
Reviewed 3 of 3 files at r6. pkg/storage/replica.go, line 2500 at r6 (raw file):
pkg/storage/replica_test.go, line 5789 at r6 (raw file):
If you're disabling ticks, why not use math.MaxInt64? pkg/storage/replica_test.go, line 5932 at r6 (raw file):
you might want a comment here that explains pkg/storage/replica_test.go, line 5953 at r6 (raw file):
NYC but random whitespace here =/ pkg/storage/replica_test.go, line 6065 at r6 (raw file):
again, yet this time you're using 24 hours? this invites speculation. Comments from Reviewable |
Review status: all files reviewed at latest revision, 10 unresolved discussions, all commit checks successful. pkg/storage/replica.go, line 2500 at r6 (raw file):
|
The main objective of this change is to (later) enable proposer-evaluated KV to
compute the
WriteBatch
when evaluating a proposal (i.e. when turninga
BatchRequest
into a*ProposalData
). The previous code assumes makinga proposal is cheap, and thus it is done under a large critical sections.
MaxLeaseIndex is assigned at the latest possible moment before submitting to
Raft. Multiple inbound requests can pass the command queue without interacting,
and it's important to assign the Lease index only right before when the
proposal is submitted to Raft.
Note that the command queue currently doesn't cover all the data accessed by
Raft commands (#10084) and that a discussion of how precisely command
evaluation will work is still being discussed (#6290). Nevertheless, this
change should be safe and a step in the right direction.
This change is