From 1cc8f4c9e7daba452753483d8b48de0e86f00a07 Mon Sep 17 00:00:00 2001 From: Radu Berinde Date: Mon, 29 Jul 2024 19:12:37 -0700 Subject: [PATCH] sstable: remove NewIterWithBlockPropertyFilters --- merging_iter_test.go | 3 ++- sstable/block_property_test.go | 6 ++++-- sstable/random_test.go | 9 +++++---- sstable/reader.go | 27 ++++----------------------- sstable/testdata/virtual_reader_iter | 5 ++--- 5 files changed, 17 insertions(+), 33 deletions(-) diff --git a/merging_iter_test.go b/merging_iter_test.go index e2ffdeb73d..d167bc9c82 100644 --- a/merging_iter_test.go +++ b/merging_iter_test.go @@ -175,7 +175,8 @@ func TestMergingIterCornerCases(t *testing.T) { } } if kinds.Point() { - set.point, err = r.NewIterWithBlockPropertyFilters( + set.point, err = r.NewIterWithBlockPropertyFiltersAndContextEtc( + context.Background(), sstable.NoTransforms, opts.GetLowerBound(), opts.GetUpperBound(), nil, sstable.AlwaysUseFilterBlock, iio.stats, sstable.CategoryAndQoS{}, nil, sstable.MakeTrivialReaderProvider(r)) diff --git a/sstable/block_property_test.go b/sstable/block_property_test.go index f428fa76f3..1d96d4677c 100644 --- a/sstable/block_property_test.go +++ b/sstable/block_property_test.go @@ -971,7 +971,8 @@ func TestBlockProperties(t *testing.T) { } else if !ok { return "filter excludes entire table" } - iter, err := r.NewIterWithBlockPropertyFilters( + iter, err := r.NewIterWithBlockPropertyFiltersAndContextEtc( + context.Background(), NoTransforms, lower, upper, filterer, NeverUseFilterBlock, &stats, CategoryAndQoS{}, nil, MakeTrivialReaderProvider(r)) if err != nil { @@ -1053,7 +1054,8 @@ func TestBlockProperties_BoundLimited(t *testing.T) { } else if !ok { return "filter excludes entire table" } - iter, err := r.NewIterWithBlockPropertyFilters( + iter, err := r.NewIterWithBlockPropertyFiltersAndContextEtc( + context.Background(), NoTransforms, lower, upper, filterer, NeverUseFilterBlock, &stats, CategoryAndQoS{}, nil, MakeTrivialReaderProvider(r)) if err != nil { diff --git a/sstable/random_test.go b/sstable/random_test.go index a13dc1c90b..981bd85fba 100644 --- a/sstable/random_test.go +++ b/sstable/random_test.go @@ -92,15 +92,16 @@ func runErrorInjectionTest(t *testing.T, seed int64) { }, nil, nil) } - // TOOD(jackson): NewIterWithBlockPropertyFilters returns an iterator over - // point keys only. Should we add variants of this test that run random - // operations on the range deletion and range key iterators? + // TOOD(jackson): NewIterWithBlockPropertyFiltersAndContextEtc returns an + // iterator over point keys only. Should we add variants of this test that run + // random operations on the range deletion and range key iterators? var stats base.InternalIteratorStats filterBlockSizeLimit := AlwaysUseFilterBlock if rng.Intn(2) == 1 { filterBlockSizeLimit = NeverUseFilterBlock } - it, err := r.NewIterWithBlockPropertyFilters( + it, err := r.NewIterWithBlockPropertyFiltersAndContextEtc( + context.Background(), NoTransforms, nil /* lower TODO */, nil, /* upper TODO */ filterer, diff --git a/sstable/reader.go b/sstable/reader.go index d1de22b455..7c18792d0f 100644 --- a/sstable/reader.go +++ b/sstable/reader.go @@ -151,27 +151,8 @@ func (r *Reader) Close() error { return nil } -// NewIterWithBlockPropertyFilters returns an iterator for the contents of the -// table. If an error occurs, NewIterWithBlockPropertyFilters cleans up after -// itself and returns a nil iterator. -func (r *Reader) NewIterWithBlockPropertyFilters( - transforms IterTransforms, - lower, upper []byte, - filterer *BlockPropertiesFilterer, - filterBlockSizeLimit FilterBlockSizeLimit, - stats *base.InternalIteratorStats, - categoryAndQoS CategoryAndQoS, - statsCollector *CategoryStatsCollector, - rp ReaderProvider, -) (Iterator, error) { - return r.newIterWithBlockPropertyFiltersAndContext( - context.Background(), transforms, lower, upper, filterer, filterBlockSizeLimit, - stats, categoryAndQoS, statsCollector, rp, nil) -} - -// NewIterWithBlockPropertyFiltersAndContextEtc is similar to -// NewIterWithBlockPropertyFilters and additionally accepts a context for -// tracing. +// NewIterWithBlockPropertyFiltersAndContextEtc returns an iterator for the +// point keys in the table. // // If transform.HideObsoletePoints is set, the callee assumes that filterer // already includes obsoleteKeyBlockPropertyFilter. The caller can satisfy this @@ -248,8 +229,8 @@ func (r *Reader) newIterWithBlockPropertyFiltersAndContext( func (r *Reader) NewIter(transforms IterTransforms, lower, upper []byte) (Iterator, error) { // TODO(radu): we should probably not use bloom filters in this case, as there // likely isn't a cache set up. - return r.NewIterWithBlockPropertyFilters( - transforms, lower, upper, nil, AlwaysUseFilterBlock, + return r.NewIterWithBlockPropertyFiltersAndContextEtc( + context.TODO(), transforms, lower, upper, nil, AlwaysUseFilterBlock, nil /* stats */, CategoryAndQoS{}, nil /* statsCollector */, MakeTrivialReaderProvider(r)) } diff --git a/sstable/testdata/virtual_reader_iter b/sstable/testdata/virtual_reader_iter index 3c09dd1147..1c23a66bbb 100644 --- a/sstable/testdata/virtual_reader_iter +++ b/sstable/testdata/virtual_reader_iter @@ -55,9 +55,8 @@ scan-range-key ---- a-d:{(#11,RANGEKEYSET,@10,foo)} -# Test iterators with various bounds, and various operations. This calls -# VirtualReader.NewIterWithBlockPropertyFilters and performs various operations -# on those. +# Test iterators with various bounds, and various operations. This creates a new +# iterator using the virtual reader and performs various operations on those. build a.SET.1:a b.SET.2:b