@@ -1025,7 +1025,13 @@ func NewPebble(ctx context.Context, cfg PebbleConfig) (p *Pebble, err error) {
10251025 ValueBlocksEnabled .Get (& cfg .Settings .SV )
10261026 }
10271027 opts .Experimental .DisableIngestAsFlushable = func () bool {
1028- return ! IngestAsFlushable .Get (& cfg .Settings .SV )
1028+ // Disable flushable ingests if shared storage is enabled. This is because
1029+ // flushable ingests currently do not support Excise operations.
1030+ //
1031+ // TODO(bilal): Remove the first part of this || statement when
1032+ // https://github.com/cockroachdb/pebble/issues/2676 is completed, or when
1033+ // Pebble has better guards against this.
1034+ return cfg .SharedStorage != nil || ! IngestAsFlushable .Get (& cfg .Settings .SV )
10291035 }
10301036
10311037 auxDir := opts .FS .PathJoin (cfg .Dir , base .AuxiliaryDir )
@@ -1475,6 +1481,20 @@ func (p *Pebble) NewEngineIterator(opts IterOptions) EngineIterator {
14751481 return newPebbleIterator (p .db , opts , StandardDurability , p )
14761482}
14771483
1484+ // ScanInternal implements the Engine interface.
1485+ func (p * Pebble ) ScanInternal (
1486+ ctx context.Context ,
1487+ lower , upper roachpb.Key ,
1488+ visitPointKey func (key * pebble.InternalKey , value pebble.LazyValue , info pebble.IteratorLevel ) error ,
1489+ visitRangeDel func (start []byte , end []byte , seqNum uint64 ) error ,
1490+ visitRangeKey func (start []byte , end []byte , keys []rangekey.Key ) error ,
1491+ visitSharedFile func (sst * pebble.SharedSSTMeta ) error ,
1492+ ) error {
1493+ rawLower := EngineKey {Key : lower }.Encode ()
1494+ rawUpper := EngineKey {Key : upper }.Encode ()
1495+ return p .db .ScanInternal (ctx , rawLower , rawUpper , visitPointKey , visitRangeDel , visitRangeKey , visitSharedFile )
1496+ }
1497+
14781498// ConsistentIterators implements the Engine interface.
14791499func (p * Pebble ) ConsistentIterators () bool {
14801500 return false
@@ -2033,6 +2053,17 @@ func (p *Pebble) IngestExternalFilesWithStats(
20332053 return p .db .IngestWithStats (paths )
20342054}
20352055
2056+ // IngestAndExciseExternalFiles implements the Engine interface.
2057+ func (p * Pebble ) IngestAndExciseExternalFiles (
2058+ ctx context.Context , paths []string , shared []pebble.SharedSSTMeta , exciseSpan roachpb.Span ,
2059+ ) (pebble.IngestOperationStats , error ) {
2060+ rawSpan := pebble.KeyRange {
2061+ Start : EngineKey {Key : exciseSpan .Key }.Encode (),
2062+ End : EngineKey {Key : exciseSpan .EndKey }.Encode (),
2063+ }
2064+ return p .db .IngestAndExcise (paths , shared , rawSpan )
2065+ }
2066+
20362067// PreIngestDelay implements the Engine interface.
20372068func (p * Pebble ) PreIngestDelay (ctx context.Context ) {
20382069 preIngestDelay (ctx , p , p .settings )
@@ -2444,10 +2475,23 @@ func (p *pebbleReadOnly) PinEngineStateForIterators() error {
24442475 return nil
24452476}
24462477
2478+ // ScanInternal implements the Reader interface.
2479+ func (p * pebbleReadOnly ) ScanInternal (
2480+ ctx context.Context ,
2481+ lower , upper roachpb.Key ,
2482+ visitPointKey func (key * pebble.InternalKey , value pebble.LazyValue , info pebble.IteratorLevel ) error ,
2483+ visitRangeDel func (start []byte , end []byte , seqNum uint64 ) error ,
2484+ visitRangeKey func (start []byte , end []byte , keys []rangekey.Key ) error ,
2485+ visitSharedFile func (sst * pebble.SharedSSTMeta ) error ,
2486+ ) error {
2487+ return p .parent .ScanInternal (ctx , lower , upper , visitPointKey , visitRangeDel , visitRangeKey , visitSharedFile )
2488+ }
2489+
24472490// Writer methods are not implemented for pebbleReadOnly. Ideally, the code
24482491// could be refactored so that a Reader could be supplied to evaluateBatch
24492492
24502493// Writer is the write interface to an engine's data.
2494+
24512495func (p * pebbleReadOnly ) ApplyBatchRepr (repr []byte , sync bool ) error {
24522496 panic ("not implemented" )
24532497}
@@ -2621,6 +2665,20 @@ func (p *pebbleSnapshot) PinEngineStateForIterators() error {
26212665 return nil
26222666}
26232667
2668+ // ScanInternal implements the Reader interface.
2669+ func (p * pebbleSnapshot ) ScanInternal (
2670+ ctx context.Context ,
2671+ lower , upper roachpb.Key ,
2672+ visitPointKey func (key * pebble.InternalKey , value pebble.LazyValue , info pebble.IteratorLevel ) error ,
2673+ visitRangeDel func (start []byte , end []byte , seqNum uint64 ) error ,
2674+ visitRangeKey func (start []byte , end []byte , keys []rangekey.Key ) error ,
2675+ visitSharedFile func (sst * pebble.SharedSSTMeta ) error ,
2676+ ) error {
2677+ rawLower := EngineKey {Key : lower }.Encode ()
2678+ rawUpper := EngineKey {Key : upper }.Encode ()
2679+ return p .snapshot .ScanInternal (ctx , rawLower , rawUpper , visitPointKey , visitRangeDel , visitRangeKey , visitSharedFile )
2680+ }
2681+
26242682// ExceedMaxSizeError is the error returned when an export request
26252683// fails due the export size exceeding the budget. This can be caused
26262684// by large KVs that have many revisions.
0 commit comments