Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
storage: strengthen time-bound iteration guarantees
Previously, the minimum and maximum timestamps used to configure a "time-bound" iterator were only hints. The iterator would surface keys outside those bounds frequently if the keys were contained within a sstable block that also contained keys within bounds. This commit adapts the iterator construction to use Pebble's IterOptions.SkipPoint option to filter out-of-range keys without yielding them to the caller. This adds a small additional overhead to processing KVs that are ultimately yielded to the user of a MVCCIncrementalIterator, but removes a large overhead to proessing KVs that are ultimately skipped. In the current MVCCIncrementalIterator implementation, keys that are outside the time range still reposition the iterator without time bound. This repositioning no longer happens, and removing this overhead more than reclaims the RefreshRange benchmark's regression from the introduction value blocks packing keys more densely. This also serves as a step towards cockroachdb#66869. ``` goos: linux goarch: amd64 cpu: Intel(R) Xeon(R) CPU @ 2.80GHz │ old.txt │ new.txt │ │ sec/op │ sec/op vs base │ RefreshRange/linear-keys/refresh_window=[0.00,0.00]-24 150.73µ ± 1% 55.75µ ± 1% -63.01% (p=0.000 n=10) RefreshRange/linear-keys/refresh_window=[0.00,50.00]-24 16.52µ ± 1% 16.19µ ± 2% -2.00% (p=0.005 n=10) RefreshRange/linear-keys/refresh_window=[0.00,75.00]-24 13.94µ ± 1% 13.59µ ± 1% -2.55% (p=0.000 n=10) RefreshRange/linear-keys/refresh_window=[0.00,95.00]-24 13.97µ ± 1% 13.56µ ± 3% -2.99% (p=0.002 n=10) RefreshRange/linear-keys/refresh_window=[0.00,99.00]-24 13.96µ ± 1% 13.45µ ± 3% -3.69% (p=0.000 n=10) RefreshRange/linear-keys/refresh_window=[50.00,50.00]-24 149.95µ ± 1% 55.67µ ± 1% -62.88% (p=0.000 n=10) RefreshRange/linear-keys/refresh_window=[50.00,75.00]-24 22.05µ ± 1% 21.70µ ± 0% -1.57% (p=0.000 n=10) RefreshRange/linear-keys/refresh_window=[50.00,95.00]-24 22.08µ ± 1% 21.61µ ± 0% -2.14% (p=0.000 n=10) RefreshRange/linear-keys/refresh_window=[50.00,99.00]-24 21.91µ ± 1% 21.69µ ± 1% -0.99% (p=0.000 n=10) RefreshRange/linear-keys/refresh_window=[75.00,75.00]-24 139.27µ ± 1% 55.82µ ± 1% -59.92% (p=0.000 n=10) RefreshRange/linear-keys/refresh_window=[75.00,95.00]-24 23.76µ ± 1% 23.36µ ± 0% -1.66% (p=0.000 n=10) RefreshRange/linear-keys/refresh_window=[75.00,99.00]-24 23.85µ ± 1% 23.25µ ± 1% -2.48% (p=0.000 n=10) RefreshRange/linear-keys/refresh_window=[95.00,95.00]-24 138.94µ ± 1% 55.52µ ± 0% -60.04% (p=0.000 n=10) RefreshRange/linear-keys/refresh_window=[95.00,99.00]-24 26.68µ ± 1% 26.30µ ± 1% -1.42% (p=0.005 n=10) RefreshRange/linear-keys/refresh_window=[99.00,99.00]-24 141.39µ ± 1% 55.02µ ± 1% -61.09% (p=0.000 n=10) RefreshRange/random-keys/refresh_window=[0.00,0.00]-24 322.35µ ± 0% 51.21µ ± 0% -84.11% (p=0.000 n=10) RefreshRange/random-keys/refresh_window=[0.00,50.00]-24 16.35µ ± 1% 16.63µ ± 2% ~ (p=0.105 n=10) RefreshRange/random-keys/refresh_window=[0.00,75.00]-24 17.42µ ± 1% 17.29µ ± 3% ~ (p=0.796 n=10) RefreshRange/random-keys/refresh_window=[0.00,95.00]-24 13.40µ ± 1% 13.45µ ± 1% ~ (p=0.529 n=10) RefreshRange/random-keys/refresh_window=[0.00,99.00]-24 13.59µ ± 2% 13.41µ ± 0% ~ (p=0.239 n=10) RefreshRange/random-keys/refresh_window=[50.00,50.00]-24 707.5m ± 1% 111.7m ± 1% -84.21% (p=0.000 n=10) RefreshRange/random-keys/refresh_window=[50.00,75.00]-24 21.94µ ± 1% 17.86µ ± 0% -18.59% (p=0.000 n=10) RefreshRange/random-keys/refresh_window=[50.00,95.00]-24 13.95µ ± 1% 13.54µ ± 1% -2.94% (p=0.000 n=10) RefreshRange/random-keys/refresh_window=[50.00,99.00]-24 13.96µ ± 0% 13.53µ ± 1% -3.06% (p=0.000 n=10) RefreshRange/random-keys/refresh_window=[75.00,75.00]-24 395.22m ± 0% 33.81m ± 1% -91.45% (p=0.000 n=10) RefreshRange/random-keys/refresh_window=[75.00,95.00]-24 19.42µ ± 1% 19.40µ ± 1% ~ (p=0.912 n=10) RefreshRange/random-keys/refresh_window=[75.00,99.00]-24 19.37µ ± 1% 19.42µ ± 1% ~ (p=0.247 n=10) RefreshRange/random-keys/refresh_window=[95.00,95.00]-24 546.66m ± 3% 48.48m ± 3% -91.13% (p=0.000 n=10) RefreshRange/random-keys/refresh_window=[95.00,99.00]-24 21.69µ ± 1% 19.68µ ± 1% -9.24% (p=0.000 n=10) RefreshRange/random-keys/refresh_window=[99.00,99.00]-24 546.27m ± 0% 48.73m ± 3% -91.08% (p=0.000 n=10) RefreshRange/mixed-case/refresh_window=[0.00,0.00]-24 410.1µ ± 0% 221.1µ ± 1% -46.09% (p=0.000 n=10) RefreshRange/mixed-case/refresh_window=[0.00,50.00]-24 14.84µ ± 1% 14.84µ ± 1% ~ (p=0.739 n=10) RefreshRange/mixed-case/refresh_window=[0.00,75.00]-24 14.84µ ± 1% 14.83µ ± 1% ~ (p=0.615 n=10) RefreshRange/mixed-case/refresh_window=[0.00,95.00]-24 17.39µ ± 2% 17.51µ ± 2% +0.68% (p=0.029 n=10) RefreshRange/mixed-case/refresh_window=[0.00,99.00]-24 16.41µ ± 1% 16.38µ ± 1% ~ (p=0.971 n=10) RefreshRange/mixed-case/refresh_window=[50.00,50.00]-24 660.9m ± 0% 140.6m ± 3% -78.73% (p=0.000 n=10) RefreshRange/mixed-case/refresh_window=[50.00,75.00]-24 20.43µ ± 1% 15.46µ ± 1% -24.31% (p=0.000 n=10) RefreshRange/mixed-case/refresh_window=[50.00,95.00]-24 18.03µ ± 1% 17.66µ ± 1% -2.01% (p=0.000 n=10) RefreshRange/mixed-case/refresh_window=[50.00,99.00]-24 16.86µ ± 1% 16.70µ ± 1% -0.93% (p=0.011 n=10) RefreshRange/mixed-case/refresh_window=[75.00,75.00]-24 659.5m ± 1% 137.1m ± 3% -79.21% (p=0.000 n=10) RefreshRange/mixed-case/refresh_window=[75.00,95.00]-24 17.96µ ± 1% 17.65µ ± 1% -1.77% (p=0.000 n=10) RefreshRange/mixed-case/refresh_window=[75.00,99.00]-24 16.86µ ± 1% 16.66µ ± 1% -1.23% (p=0.008 n=10) RefreshRange/mixed-case/refresh_window=[95.00,95.00]-24 900.95µ ± 0% 32.18µ ± 0% -96.43% (p=0.000 n=10) RefreshRange/mixed-case/refresh_window=[95.00,99.00]-24 14.35µ ± 1% 14.50µ ± 2% +1.03% (p=0.002 n=10) RefreshRange/mixed-case/refresh_window=[99.00,99.00]-24 227.235m ± 1% 3.361m ± 1% -98.52% (p=0.000 n=10) geomean 136.9µ 73.57µ -46.24% goos: linux goarch: amd64 cpu: Intel(R) Xeon(R) CPU @ 2.80GHz │ old2.txt │ new2.txt │ │ sec/op │ sec/op vs base │ MVCCIncrementalIterator/ts=5-24 24.93m ± 3% 24.53m ± 2% -1.61% (p=0.004 n=10) MVCCIncrementalIterator/ts=480-24 560.4µ ± 1% 453.8µ ± 0% -19.02% (p=0.000 n=10) MVCCIncrementalIteratorForOldData/valueSize=100-24 1.444m ± 0% 1.434m ± 0% -0.72% (p=0.000 n=10) MVCCIncrementalIteratorForOldData/valueSize=500-24 1.994m ± 0% 1.974m ± 1% -1.02% (p=0.000 n=10) MVCCIncrementalIteratorForOldData/valueSize=1000-24 2.672m ± 1% 2.649m ± 1% ~ (p=0.063 n=10) MVCCIncrementalIteratorForOldData/valueSize=2000-24 4.059m ± 1% 4.009m ± 1% -1.23% (p=0.011 n=10) geomean 2.754m 2.635m -4.33% ``` Epic: none Informs cockroachdb#66869 Close cockroachdb#98881 Release note: none
- Loading branch information