-
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: optimize DeleteRange
when deleting entire Raft range
#85522
storage: optimize DeleteRange
when deleting entire Raft range
#85522
Conversation
CC @ajwerner, relevant for schema GC. Btw, there's a risk here that if the MVCC stats are completely off then we may not run MVCC GC. Maybe schema GC should do a stats scan for any ranges with estimates, to make sure we correctly account for the garbage and that MVCC GC will pick it up? |
4d11d7f
to
6b3ac2f
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.
Some nits on comments where I think it makes more sense to explain why certain things are done.
This patch adds a fast path for `DeleteRange` when deleting an entire Raft range, by simply marking all live data as deleted in MVCC stats instead of scanning across all point keys. It will still perform a time-bound scan to look for conflicts with newer writes, and a range key scan to take range key fragmentation into account for stats. There are no behavioral changes. The fast path is therefore tested comprehensively by adding a metamorphic parameter for it in `TestMVCCHistories`. Benchmarks confirm that the fast path is ~constant, while the slow path is asymptotically linear. ``` BenchmarkMVCCDeleteRangeUsingTombstone_Pebble/numKeys=1000/valueSize=64/entireRange=false-24 499 2319384 ns/op 48.29 MB/s BenchmarkMVCCDeleteRangeUsingTombstone_Pebble/numKeys=1000/valueSize=64/entireRange=true-24 577 1965157 ns/op 56.99 MB/s BenchmarkMVCCDeleteRangeUsingTombstone_Pebble/numKeys=10000/valueSize=64/entireRange=false-24 216 5531790 ns/op 202.47 MB/s BenchmarkMVCCDeleteRangeUsingTombstone_Pebble/numKeys=10000/valueSize=64/entireRange=true-24 576 2014470 ns/op 555.98 MB/s BenchmarkMVCCDeleteRangeUsingTombstone_Pebble/numKeys=100000/valueSize=64/entireRange=false-24 32 37814215 ns/op 296.18 MB/s BenchmarkMVCCDeleteRangeUsingTombstone_Pebble/numKeys=100000/valueSize=64/entireRange=true-24 589 2022481 ns/op 5537.75 MB/s ``` Release note: None
6b3ac2f
to
85146a8
Compare
TFTR! bors r=aliher1911 |
Build failed (retrying...): |
Build failed (retrying...): |
Build succeeded: |
This patch adds a fast path for
DeleteRange
when deleting an entireRaft range, by simply marking all live data as deleted in MVCC stats
instead of scanning across all point keys. It will still perform a
time-bound scan to look for conflicts with newer writes, and a range key
scan to take range key fragmentation into account for stats.
There are no behavioral changes. The fast path is therefore tested
comprehensively by adding a metamorphic parameter for it in
TestMVCCHistories
.Benchmarks confirm that the fast path is ~constant, while the slow path
is asymptotically linear.
Resolves #83696.
Release note: None