-
Notifications
You must be signed in to change notification settings - Fork 3.9k
storage: always write RANGEKEYDELs in ClearRangeWithHeuristic #145096
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
Conversation
Just curious - why doesn't the same apply to point deletes? |
If we end up writing point deletes, we won't be able to pursue a delete-only compaction either. But if the heuristic triggers and there were fewer keys than the threshold (64 during replica removals), it was unlikely that we could've found a sstable wholly contained within the key span anyways because there are so few keys. The same logic doesn't apply for range keys, since a single range key can have a very broad key span. |
I see - still, what's the downside of writing a single rangedel vs multiple point dels? |
I think the iteration overhead of a rangedel is higher than a small quantity of point dels because |
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 6 of 6 files at r1, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @jbowens)
pkg/storage/engine.go
line 1599 at r1 (raw file):
// will switch from clearing individual keys using point tombstones to clearing // the entire range using Pebble range tombstones (RANGEDELs). Setting // pointKeyThreshold to 0 disables checking for and clearing point keys. NB: An
This 0 behavior is very confusing, and I don't see any code in production calling it with 0.
Similarly for rangeKeyThreshold
. Can we require this threshold to be > 0 and eliminate the shouldClearRangeKeys
parameter?
7e94755
to
93b22d3
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.
TFTR!
Reviewable status:
complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @sumeerbhola)
pkg/storage/engine.go
line 1599 at r1 (raw file):
Previously, sumeerbhola wrote…
This 0 behavior is very confusing, and I don't see any code in production calling it with 0.
Similarly forrangeKeyThreshold
. Can we require this threshold to be > 0 and eliminate theshouldClearRangeKeys
parameter?
Good call, Done.
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 6 of 6 files at r2, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @jbowens)
c448f92
to
6ce4031
Compare
Previously, ClearRangeWithHeuristic applied a heuristic that would switch between writing RANGEKEYUNSETs versus RANGEKEYDELs. When multiple range keys overlap, unsetting each individual range key with RANGEKEYUNSET is strictly worse than writing a single RANGEKEYDEL over the same span. This commit adapts ClearRangeWithHeuristic to write a single RANGEKEYDEL over the cleared span, but only if there are indeed range keys within the span. Setting a broad RANGEKEYDEL increases the likelihood that data can be removed using a delete-only compaction. Close cockroachdb#144954. Epic: none Release note: none
6ce4031
to
614868e
Compare
TFTR! bors r=sumeerbhola |
Previously, ClearRangeWithHeuristic applied a heuristic that would switch between writing RANGEKEYUNSETs versus RANGEKEYDELs. When multiple range keys overlap, unsetting each individual range key with RANGEKEYUNSET is strictly worse than writing a single RANGEKEYDEL over the same span.
This commit adapts ClearRangeWithHeuristic to write a single RANGEKEYDEL over the cleared span, but only if there are indeed range keys within the span. Setting a broad RANGEKEYDEL increases the likelihood that data can be removed using a delete-only compaction.
Close #144954.
Epic: none
Release note: none