storage: add MVCCIterator.RangeKeyChanged()#86056
Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom Aug 13, 2022
Merged
storage: add MVCCIterator.RangeKeyChanged()#86056craig[bot] merged 1 commit intocockroachdb:masterfrom
MVCCIterator.RangeKeyChanged()#86056craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
Member
jbowens
approved these changes
Aug 12, 2022
Contributor
jbowens
left a comment
There was a problem hiding this comment.
Reviewed 17 of 18 files at r1, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @sumeerbhola)
35814ac to
b7cc061
Compare
This patch adds `RangeKeyChanged()` to the MVCC iterator interface, returning `true` if the latest positioning operation caused the overlapping range keys to change. Previously returned `RangeKeys()` and `RangeBounds()` values are valid as long as this returns `false`. Support has been implemented in most iterators, but not yet for `MVCCIncrementalIterator` which is less trivial (in particular due to the mixing of operations that respect and ignore time bounds via e.g. `NextIgnoringTime`). No callers make use of this yet. `intentInterleavingIter` likely takes a slight performance hit from this, but benchmarks are inconclusive. This will possibly be made up for by replacing `HasPointAndRange()` calls in hot paths with `RangeKeyChanged()`, even in the no-range-key case. ``` MVCCScan_Pebble/rows=1/versions=1/valueSize=64/numRangeKeys=0-24 5.55µs ± 1% 5.56µs ± 1% ~ (p=0.921 n=9+10) MVCCScan_Pebble/rows=1/versions=1/valueSize=64/numRangeKeys=1-24 12.1µs ± 1% 12.2µs ± 3% ~ (p=0.196 n=10+10) MVCCScan_Pebble/rows=1/versions=1/valueSize=64/numRangeKeys=100-24 165µs ± 1% 164µs ± 1% -0.83% (p=0.002 n=10+8) MVCCScan_Pebble/rows=100/versions=1/valueSize=64/numRangeKeys=0-24 38.5µs ± 1% 39.0µs ± 2% +1.38% (p=0.002 n=10+10) MVCCScan_Pebble/rows=100/versions=1/valueSize=64/numRangeKeys=1-24 71.8µs ± 1% 72.2µs ± 0% +0.51% (p=0.035 n=10+9) MVCCScan_Pebble/rows=100/versions=1/valueSize=64/numRangeKeys=100-24 179µs ± 1% 177µs ± 1% -0.88% (p=0.002 n=10+8) MVCCScan_Pebble/rows=10000/versions=1/valueSize=64/numRangeKeys=0-24 2.76ms ± 1% 2.79ms ± 0% +1.16% (p=0.000 n=10+10) MVCCScan_Pebble/rows=10000/versions=1/valueSize=64/numRangeKeys=1-24 5.41ms ± 1% 5.48ms ± 1% +1.21% (p=0.000 n=10+10) MVCCScan_Pebble/rows=10000/versions=1/valueSize=64/numRangeKeys=100-24 6.52ms ± 1% 6.53ms ± 2% ~ (p=0.739 n=10+10) MVCCReverseScan_Pebble/rows=1/versions=1/valueSize=64/numRangeKeys=0-24 5.96µs ± 1% 6.08µs ± 1% +1.97% (p=0.000 n=9+9) MVCCReverseScan_Pebble/rows=1/versions=1/valueSize=64/numRangeKeys=1-24 12.1µs ± 1% 12.2µs ± 1% +0.56% (p=0.014 n=9+10) MVCCReverseScan_Pebble/rows=1/versions=1/valueSize=64/numRangeKeys=100-24 92.3µs ± 1% 91.2µs ± 1% -1.18% (p=0.000 n=10+9) MVCCReverseScan_Pebble/rows=100/versions=1/valueSize=64/numRangeKeys=0-24 51.7µs ± 2% 51.7µs ± 1% ~ (p=0.529 n=10+10) MVCCReverseScan_Pebble/rows=100/versions=1/valueSize=64/numRangeKeys=1-24 85.6µs ± 1% 86.0µs ± 1% ~ (p=0.093 n=10+10) MVCCReverseScan_Pebble/rows=100/versions=1/valueSize=64/numRangeKeys=100-24 183µs ± 1% 183µs ± 1% ~ (p=0.481 n=10+10) MVCCReverseScan_Pebble/rows=10000/versions=1/valueSize=64/numRangeKeys=0-24 3.97ms ± 1% 3.98ms ± 1% ~ (p=0.063 n=10+10) MVCCReverseScan_Pebble/rows=10000/versions=1/valueSize=64/numRangeKeys=1-24 6.70ms ± 1% 6.73ms ± 0% +0.39% (p=0.028 n=10+9) MVCCReverseScan_Pebble/rows=10000/versions=1/valueSize=64/numRangeKeys=100-24 7.78ms ± 1% 7.84ms ± 1% +0.77% (p=0.005 n=10+10) MVCCGet_Pebble/batch=false/versions=1/valueSize=8/numRangeKeys=0-24 5.35µs ± 2% 5.34µs ± 2% ~ (p=0.493 n=10+10) MVCCGet_Pebble/batch=false/versions=1/valueSize=8/numRangeKeys=1-24 11.4µs ± 1% 11.6µs ± 1% +1.67% (p=0.000 n=10+8) MVCCGet_Pebble/batch=false/versions=1/valueSize=8/numRangeKeys=100-24 179µs ± 1% 176µs ± 1% -1.66% (p=0.000 n=10+9) MVCCGet_Pebble/batch=false/versions=10/valueSize=8/numRangeKeys=0-24 6.47µs ± 2% 6.43µs ± 1% ~ (p=0.315 n=10+10) MVCCGet_Pebble/batch=false/versions=10/valueSize=8/numRangeKeys=1-24 17.3µs ± 1% 17.6µs ± 2% +1.90% (p=0.000 n=10+10) MVCCGet_Pebble/batch=false/versions=10/valueSize=8/numRangeKeys=100-24 184µs ± 2% 182µs ± 1% -0.91% (p=0.010 n=10+9) MVCCGet_Pebble/batch=false/versions=100/valueSize=8/numRangeKeys=0-24 15.2µs ± 2% 15.2µs ± 4% ~ (p=0.631 n=10+10) MVCCGet_Pebble/batch=false/versions=100/valueSize=8/numRangeKeys=1-24 58.0µs ± 2% 57.6µs ± 3% ~ (p=0.218 n=10+10) MVCCGet_Pebble/batch=false/versions=100/valueSize=8/numRangeKeys=100-24 230µs ± 1% 225µs ± 2% -2.15% (p=0.000 n=10+10) MVCCGet_Pebble/batch=true/versions=1/valueSize=8/numRangeKeys=0-24 3.69µs ± 2% 3.63µs ± 1% -1.60% (p=0.001 n=9+10) MVCCGet_Pebble/batch=true/versions=1/valueSize=8/numRangeKeys=1-24 8.59µs ± 1% 8.68µs ± 1% +1.07% (p=0.003 n=10+10) MVCCGet_Pebble/batch=true/versions=1/valueSize=8/numRangeKeys=100-24 169µs ± 1% 165µs ± 1% -2.17% (p=0.000 n=10+10) MVCCGet_Pebble/batch=true/versions=10/valueSize=8/numRangeKeys=0-24 4.63µs ± 1% 4.61µs ± 2% ~ (p=0.356 n=9+10) MVCCGet_Pebble/batch=true/versions=10/valueSize=8/numRangeKeys=1-24 14.2µs ± 1% 14.3µs ± 0% +0.97% (p=0.000 n=10+8) MVCCGet_Pebble/batch=true/versions=10/valueSize=8/numRangeKeys=100-24 173µs ± 1% 169µs ± 1% -2.26% (p=0.000 n=10+10) MVCCGet_Pebble/batch=true/versions=100/valueSize=8/numRangeKeys=0-24 11.9µs ± 4% 11.8µs ± 3% ~ (p=0.720 n=10+9) MVCCGet_Pebble/batch=true/versions=100/valueSize=8/numRangeKeys=1-24 51.9µs ± 1% 52.2µs ± 1% ~ (p=0.156 n=10+9) MVCCGet_Pebble/batch=true/versions=100/valueSize=8/numRangeKeys=100-24 213µs ± 1% 209µs ± 2% -1.74% (p=0.000 n=10+10) ``` Release note: None
b7cc061 to
179f935
Compare
Contributor
Author
|
TFTR! CI failures are known flake in bors r=jbowens |
Contributor
|
Build failed: |
Contributor
Author
|
bors r=jbowens |
Contributor
|
Build failed (retrying...): |
Contributor
|
Build failed (retrying...): |
Contributor
|
Build failed (retrying...): |
Contributor
|
Build succeeded: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This patch adds
RangeKeyChanged()to the MVCC iterator interface,returning
trueif the latest positioning operation caused theoverlapping range keys to change. Previously returned
RangeKeys()andRangeBounds()values are valid as long as this returnsfalse.Support has been implemented in most iterators, but not yet for
MVCCIncrementalIteratorwhich is less trivial (in particular due tothe mixing of operations that respect and ignore time bounds via e.g.
NextIgnoringTime).No callers make use of this yet.
intentInterleavingIterlikely takes a slight performance hit fromthis, but benchmarks are inconclusive. This will possibly be made up for
by replacing
HasPointAndRange()calls in hot paths withRangeKeyChanged(), even in the no-range-key case.Touches #84379.
Release note: None