-
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
kvserver: bump the in-memory GC threshold as a pre-apply side effect #83197
Conversation
0703d62
to
be23e6f
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.
Reviewed 2 of 2 files at r3, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @aayushshah15 and @arulajmani)
pkg/kv/kvserver/replica_application_state_machine.go
line 756 at r3 (raw file):
} if res.State != nil && res.State.GCThreshold != nil {
Could we add a comment here explaining why this is a pre-apply trigger? Something similar to what you have in the commit message would be great.
pkg/kv/kvserver/replica_test.go
line 8652 at r3 (raw file):
testutils.RunTrueAndFalse(t, "followerRead", func(t *testing.T, followerRead bool) { testutils.RunTrueAndFalse(t, "thresholdFirst", func(t *testing.T, thresholdFirst bool) {
[tiny nit] is this now a stray line?
ce4a73d
to
c56926c
Compare
This commit changes where the in-memory GC threshold on a Replica is bumped during the application of a GC request. Previously, the in-memory GC threshold was bumped as a post-apply side effect. Additionally, GC requests do not acquire latches at the timestamp that they are garbage collecting, and thus, readers need to take additional care to ensure that results aren't served off of a partial state. Readers today rely on the invariant that the in-memory GC threshold is bumped before the actual garbage collection. This today is true because the mvccGCQueue issues GC requests in 2 phases: the first that simply bumps the in-memory GC threshold, and the second one that performs the actual garbage collection. If the in-memory GC threshold were bumped in the pre-apply phase of command application, this usage quirk wouldn't need to exist. That's what this commit does. Relates to cockroachdb#55293 Release note: None
c56926c
to
f18f31e
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 review!
bors r+
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @aayushshah15, @arulajmani, and @nvanbenschoten)
pkg/kv/kvserver/replica_application_state_machine.go
line 756 at r3 (raw file):
Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Could we add a comment here explaining why this is a pre-apply trigger? Something similar to what you have in the commit message would be great.
Done.
Build failed (retrying...): |
Build failed (retrying...): |
Build failed: |
bors r+ |
Build succeeded: |
This commit changes where the in-memory GC threshold on a Replica is
bumped during the application of a GC request.
Previously, the in-memory GC threshold was bumped as a post-apply side
effect. Additionally, GC requests do not acquire latches at the
timestamp that they are garbage collecting, and thus, readers need to
take additional care to ensure that results aren't served off of a
partial state.
Readers today rely on the invariant that the in-memory GC threshold is
bumped before the actual garbage collection. This today is true because
the mvccGCQueue issues GC requests in 2 phases: the first that simply
bumps the in-memory GC threshold, and the second one that performs the
actual garbage collection. If the in-memory GC threshold were bumped in
the pre-apply phase of command application, this usage quirk wouldn't
need to exist. That's what this commit does.
Relates to #55293
Release note: None