storage: always write RANGEKEYDELs in ClearRangeWithHeuristic#145096
storage: always write RANGEKEYDELs in ClearRangeWithHeuristic#145096craig[bot] merged 1 commit intocockroachdb:masterfrom
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 |
sumeerbhola
left a comment
There was a problem hiding this comment.
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
jbowens
left a comment
There was a problem hiding this comment.
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 theshouldClearRangeKeysparameter?
Good call, Done.
sumeerbhola
left a comment
There was a problem hiding this comment.
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