diff --git a/external_iterator.go b/external_iterator.go index 4d81bc71c3..e667e9100b 100644 --- a/external_iterator.go +++ b/external_iterator.go @@ -108,8 +108,6 @@ func NewExternalIterWithContext( func validateExternalIterOpts(iterOpts *IterOptions) error { switch { - case iterOpts.TableFilter != nil: - return errors.Errorf("pebble: external iterator: TableFilter unsupported") case iterOpts.PointKeyFilters != nil: return errors.Errorf("pebble: external iterator: PointKeyFilters unsupported") case iterOpts.RangeKeyFilters != nil: diff --git a/iterator.go b/iterator.go index 09c98026f3..e37de7174c 100644 --- a/iterator.go +++ b/iterator.go @@ -2579,14 +2579,8 @@ func (i *Iterator) SetOptions(o *IterOptions) { // If OnlyReadGuaranteedDurable changed, the iterator stacks are incorrect, // improperly including or excluding memtables. Invalidate them so that // finishInitializingIter will reconstruct them. - // - // If either the original options or the new options specify a table filter, - // we need to reconstruct the iterator stacks. If they both supply a table - // filter, we can't be certain that it's the same filter since we have no - // mechanism to compare the filter closures. closeBoth := i.err != nil || - o.OnlyReadGuaranteedDurable != i.opts.OnlyReadGuaranteedDurable || - o.TableFilter != nil || i.opts.TableFilter != nil + o.OnlyReadGuaranteedDurable != i.opts.OnlyReadGuaranteedDurable // If either options specify block property filters for an iterator stack, // reconstruct it. diff --git a/iterator_test.go b/iterator_test.go index 651ef2081b..740a0143b6 100644 --- a/iterator_test.go +++ b/iterator_test.go @@ -1292,13 +1292,9 @@ func TestIteratorBoundsLifetimes(t *testing.T) { return buf.String() case "set-options": var label string - var tableFilter bool td.ScanArgs(t, "label", &label) opts := iterators[label].opts for _, arg := range td.CmdArgs { - if arg.Key == "table-filter" { - tableFilter = true - } if arg.Key == "key-types" { switch arg.Vals[0] { case "points-only": @@ -1313,9 +1309,6 @@ func TestIteratorBoundsLifetimes(t *testing.T) { } } opts.LowerBound, opts.UpperBound = parseBounds(td) - if tableFilter { - opts.TableFilter = func(userProps map[string]string) bool { return false } - } iterators[label].SetOptions(&opts) trashBounds(opts.LowerBound, opts.UpperBound) buf.Reset() @@ -1542,9 +1535,6 @@ func iterOptionsString(o *IterOptions) string { var buf bytes.Buffer fmt.Fprintf(&buf, "key-types=%s, lower=%q, upper=%q", o.KeyTypes, o.LowerBound, o.UpperBound) - if o.TableFilter != nil { - fmt.Fprintf(&buf, ", table-filter") - } if o.OnlyReadGuaranteedDurable { fmt.Fprintf(&buf, ", only-durable") } diff --git a/level_iter.go b/level_iter.go index 5255ece5f7..53da788b88 100644 --- a/level_iter.go +++ b/level_iter.go @@ -158,7 +158,6 @@ func (l *levelIter) init( l.prefix = nil l.lower = opts.LowerBound l.upper = opts.UpperBound - l.tableOpts.TableFilter = opts.TableFilter l.tableOpts.PointKeyFilters = opts.PointKeyFilters if len(opts.PointKeyFilters) == 0 { l.tableOpts.PointKeyFilters = l.filtersBuf[:0:1] diff --git a/options.go b/options.go index df1cccf6ec..91e4693861 100644 --- a/options.go +++ b/options.go @@ -115,11 +115,6 @@ type IterOptions struct { // boundary the iterator will return Valid()==false. Setting UpperBound // effectively truncates the key space visible to the iterator. UpperBound []byte - // TableFilter can be used to filter the tables that are scanned during - // iteration based on the user properties. Return true to scan the table and - // false to skip scanning. This function must be thread-safe since the same - // function can be used by multiple iterators, if the iterator is cloned. - TableFilter func(userProps map[string]string) bool // SkipPoint may be used to skip over point keys that don't match an // arbitrary predicate during iteration. If set, the Iterator invokes // SkipPoint for keys encountered. If SkipPoint returns true, the iterator diff --git a/table_cache.go b/table_cache.go index c8690ce8e5..cd3cb225ba 100644 --- a/table_cache.go +++ b/table_cache.go @@ -423,16 +423,10 @@ func (c *tableCacheShard) releaseLoop() { // true for ok if this table should be read by this iterator. func (c *tableCacheShard) checkAndIntersectFilters( v *tableCacheValue, - tableFilter func(userProps map[string]string) bool, blockPropertyFilters []BlockPropertyFilter, boundLimitedFilter sstable.BoundLimitedBlockPropertyFilter, syntheticSuffix sstable.SyntheticSuffix, ) (ok bool, filterer *sstable.BlockPropertiesFilterer, err error) { - if tableFilter != nil && - !tableFilter(v.reader.Properties.UserProperties) { - return false, nil, nil - } - if boundLimitedFilter != nil || len(blockPropertyFilters) > 0 { filterer, err = sstable.IntersectsTable( blockPropertyFilters, @@ -549,8 +543,8 @@ func (c *tableCacheShard) newPointIter( var ok bool var err error - ok, filterer, err = c.checkAndIntersectFilters(v, opts.TableFilter, - pointKeyFilters, internalOpts.boundLimitedFilter, file.SyntheticSuffix) + ok, filterer, err = c.checkAndIntersectFilters(v, pointKeyFilters, + internalOpts.boundLimitedFilter, file.SyntheticSuffix) if err != nil { return nil, err } else if !ok { @@ -664,7 +658,7 @@ func (c *tableCacheShard) newRangeKeyIter( // done here, rather than deferring to the block-property collector in order // to maintain parity with point keys and the treatment of RANGEDELs. if v.reader.Properties.NumRangeKeyDels == 0 && len(opts.RangeKeyFilters) > 0 { - ok, _, err := c.checkAndIntersectFilters(v, nil, opts.RangeKeyFilters, nil, nil /* TODO(radu) transforms.SyntheticSuffix */) + ok, _, err := c.checkAndIntersectFilters(v, opts.RangeKeyFilters, nil, nil /* TODO(radu) transforms.SyntheticSuffix */) if err != nil { return nil, err } else if !ok {