@@ -12,7 +12,6 @@ import (
1212 "github.com/cockroachdb/pebble/internal/base"
1313 "github.com/cockroachdb/pebble/internal/invariants"
1414 "github.com/cockroachdb/pebble/internal/manifest"
15- "github.com/cockroachdb/pebble/sstable/virtual"
1615)
1716
1817// Excise atomically deletes all data overlapping with the provided span. All
@@ -103,9 +102,8 @@ func (d *DB) exciseTable(
103102 // https://github.com/cockroachdb/pebble/issues/2112 .
104103 if d .cmp (m .Smallest .UserKey , exciseSpan .Start ) < 0 {
105104 leftTable = & tableMetadata {
106- Virtual : & virtual.VirtualReaderParams {},
107- FileBacking : m .FileBacking ,
108- FileNum : d .mu .versions .getNextFileNum (),
105+ Virtual : true ,
106+ FileNum : d .mu .versions .getNextFileNum (),
109107 // Note that these are loose bounds for smallest/largest seqnums, but they're
110108 // sufficient for maintaining correctness.
111109 SmallestSeqNum : m .SmallestSeqNum ,
@@ -118,6 +116,7 @@ func (d *DB) exciseTable(
118116 }
119117
120118 if leftTable .HasRangeKeys || leftTable .HasPointKeys {
119+ leftTable .AttachVirtualBacking (m .FileBacking )
121120 if err := determineExcisedTableSize (d .fileCache , m , leftTable ); err != nil {
122121 return nil , nil , err
123122 }
@@ -136,9 +135,8 @@ func (d *DB) exciseTable(
136135 // See comment before the definition of leftFile for the motivation behind
137136 // calculating tight user-key bounds.
138137 rightTable = & tableMetadata {
139- Virtual : & virtual.VirtualReaderParams {},
140- FileBacking : m .FileBacking ,
141- FileNum : d .mu .versions .getNextFileNum (),
138+ Virtual : true ,
139+ FileNum : d .mu .versions .getNextFileNum (),
142140 // Note that these are loose bounds for smallest/largest seqnums, but they're
143141 // sufficient for maintaining correctness.
144142 SmallestSeqNum : m .SmallestSeqNum ,
@@ -150,6 +148,7 @@ func (d *DB) exciseTable(
150148 return nil , nil , err
151149 }
152150 if rightTable .HasRangeKeys || rightTable .HasPointKeys {
151+ rightTable .AttachVirtualBacking (m .FileBacking )
153152 if err := determineExcisedTableSize (d .fileCache , m , rightTable ); err != nil {
154153 return nil , nil , err
155154 }
@@ -352,7 +351,7 @@ func applyExciseToVersionEdit(
352351 if leftTable == nil && rightTable == nil {
353352 return
354353 }
355- if originalTable .Virtual == nil {
354+ if ! originalTable .Virtual {
356355 // If the original table was virtual, then its file backing is already known
357356 // to the manifest; we don't need to create another file backing. Note that
358357 // there must be only one CreatedBackingTables entry per backing sstable.
0 commit comments