Skip to content

Commit

Permalink
sstable: remove NewIterWithBlockPropertyFilters
Browse files Browse the repository at this point in the history
  • Loading branch information
RaduBerinde committed Jul 30, 2024
1 parent 3fded19 commit 1cc8f4c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 33 deletions.
3 changes: 2 additions & 1 deletion merging_iter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
6 changes: 4 additions & 2 deletions sstable/block_property_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
9 changes: 5 additions & 4 deletions sstable/random_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
27 changes: 4 additions & 23 deletions sstable/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
}

Expand Down
5 changes: 2 additions & 3 deletions sstable/testdata/virtual_reader_iter
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1cc8f4c

Please sign in to comment.