From ba053dd3ff75dbca557e3b21195ed4cdff250660 Mon Sep 17 00:00:00 2001 From: sumeerbhola Date: Wed, 7 Jun 2023 16:44:35 -0600 Subject: [PATCH] storage: increase capacity of PointKeyFilters slice This is to conform to the recently introduced performance recommendation in pebble.IterOptions. Informs https://github.com/cockroachdb/pebble/issues/2465 Epic: none Release note: None --- pkg/storage/pebble_iterator.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/storage/pebble_iterator.go b/pkg/storage/pebble_iterator.go index 973cfe5e007a..b77b72a663d1 100644 --- a/pkg/storage/pebble_iterator.go +++ b/pkg/storage/pebble_iterator.go @@ -277,11 +277,16 @@ func (p *pebbleIterator) setOptions(opts IterOptions, durability DurabilityRequi // We are given an inclusive [MinTimestampHint, MaxTimestampHint]. The // MVCCWAllTimeIntervalCollector has collected the WallTimes and we need // [min, max), i.e., exclusive on the upper bound. - p.options.PointKeyFilters = []pebble.BlockPropertyFilter{ + // + // NB: PointKeyFilters documents that when set to non-empty, the capacity + // of the slice should be at least one more than the length, for a + // Pebble-internal performance optimization. + pkf := [2]pebble.BlockPropertyFilter{ sstable.NewBlockIntervalFilter(mvccWallTimeIntervalCollector, uint64(opts.MinTimestampHint.WallTime), uint64(opts.MaxTimestampHint.WallTime)+1), } + p.options.PointKeyFilters = pkf[:1:2] // NB: We disable range key block filtering because of complications in // MVCCIncrementalIterator.maybeSkipKeys: the TBI may see different range // key fragmentation than the main iterator due to the filtering. This would