Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
86056: storage: add `MVCCIterator.RangeKeyChanged()` r=jbowens a=erikgrinaker 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) ``` Touches #84379. Release note: None 86084: storage: omit `MVCCIterator.Stats()` call during `MVCCScan`/`MVCCGet` r=nicktrav a=erikgrinaker `MVCCScan` and `MVCCGet` attach iterator statistics to an active trace. However, they would fetch the iterator statistics even if no trace was active, which has a significant cost. This patch avoids fetching the stats when there is no active trace. ``` name old time/op new time/op delta MVCCGet_Pebble/batch=true/versions=1/valueSize=8/numRangeKeys=0-24 3.59µs ± 0% 3.34µs ± 0% -7.02% (p=0.000 n=10+8) MVCCGet_Pebble/batch=true/versions=1/valueSize=8/numRangeKeys=1-24 7.43µs ± 1% 7.01µs ± 0% -5.70% (p=0.000 n=10+9) MVCCGet_Pebble/batch=true/versions=10/valueSize=8/numRangeKeys=0-24 4.62µs ± 1% 4.36µs ± 1% -5.53% (p=0.000 n=10+10) MVCCGet_Pebble/batch=true/versions=10/valueSize=8/numRangeKeys=1-24 10.4µs ± 1% 10.0µs ± 1% -3.79% (p=0.000 n=10+10) ``` Resolves #86083. Touches #64503. Release note: None Co-authored-by: Erik Grinaker <[email protected]>
- Loading branch information