Skip to content

Commit ab99b67

Browse files
committed
exempt fix
1 parent ad27971 commit ab99b67

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

pkg/storage/pebble.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2786,11 +2786,8 @@ func (p *pebbleReadOnly) ConsistentIterators() bool {
27862786
// PinEngineStateForIterators implements the Engine interface.
27872787
func (p *pebbleReadOnly) PinEngineStateForIterators(readCategory fs.ReadCategory) error {
27882788
if p.iter == nil {
2789-
o := &pebble.IterOptions{Category: readCategory.PebbleCategory()}
2790-
if p.durability == GuaranteedDurability {
2791-
o.OnlyReadGuaranteedDurable = true
2792-
}
2793-
iter, err := p.parent.db.NewIter(o)
2789+
o := makeIterOptions(readCategory, p.durability)
2790+
iter, err := p.parent.db.NewIter(&o)
27942791
if err != nil {
27952792
return err
27962793
}

pkg/storage/pebble_batch.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -713,11 +713,11 @@ func (p *pebbleBatch) PinEngineStateForIterators(readCategory fs.ReadCategory) e
713713
var err error
714714
if p.iter == nil {
715715
var iter *pebble.Iterator
716-
o := &pebble.IterOptions{Category: readCategory.PebbleCategory()}
716+
o := makeIterOptions(readCategory, StandardDurability)
717717
if p.batch.Indexed() {
718-
iter, err = p.batch.NewIter(o)
718+
iter, err = p.batch.NewIter(&o)
719719
} else {
720-
iter, err = p.db.NewIter(o)
720+
iter, err = p.db.NewIter(&o)
721721
}
722722
if err != nil {
723723
return err

pkg/storage/pebble_iterator.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -222,17 +222,9 @@ func (p *pebbleIterator) setOptions(
222222
}
223223

224224
// Generate new Pebble iterator options.
225-
p.options = pebble.IterOptions{
226-
OnlyReadGuaranteedDurable: durability == GuaranteedDurability,
227-
KeyTypes: opts.KeyTypes,
228-
UseL6Filters: opts.useL6Filters,
229-
Category: opts.ReadCategory.PebbleCategory(),
230-
}
231-
switch opts.ReadCategory {
232-
case fs.BatchEvalReadCategory, fs.ScanRegularBatchEvalReadCategory, fs.ScanBackgroundBatchEvalReadCategory:
233-
// Exempt hot paths from iterator tracking.
234-
p.options.ExemptFromTracking = true
235-
}
225+
p.options = makeIterOptions(opts.ReadCategory, durability)
226+
p.options.KeyTypes = opts.KeyTypes
227+
p.options.UseL6Filters = opts.useL6Filters
236228
p.prefix = opts.Prefix
237229

238230
if opts.LowerBound != nil {
@@ -1048,3 +1040,13 @@ func (p *pebbleIterator) assertMVCCInvariants() error {
10481040

10491041
return nil
10501042
}
1043+
1044+
func makeIterOptions(
1045+
readCategory fs.ReadCategory, durability DurabilityRequirement,
1046+
) pebble.IterOptions {
1047+
return pebble.IterOptions{
1048+
OnlyReadGuaranteedDurable: durability == GuaranteedDurability,
1049+
Category: readCategory.PebbleCategory(),
1050+
ExemptFromTracking: readCategory == fs.BatchEvalReadCategory || readCategory == fs.ScanRegularBatchEvalReadCategory,
1051+
}
1052+
}

0 commit comments

Comments
 (0)