Skip to content

Commit 4aeacab

Browse files
committed
virtual: remove Size and BackingSize from VirtualReaderParams
1 parent c1d56c3 commit 4aeacab

File tree

5 files changed

+6
-14
lines changed

5 files changed

+6
-14
lines changed

data_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1291,7 +1291,7 @@ func runSSTablePropertiesCmd(t *testing.T, td *datadriven.TestData, d *DB) strin
12911291
if m != nil && m.Virtual != nil {
12921292
m.InitVirtual(false /* isShared */)
12931293
env.Virtual = m.Virtual
1294-
scaledProps := r.Properties.GetScaledProperties(env.Virtual.BackingSize, env.Virtual.Size)
1294+
scaledProps := r.Properties.GetScaledProperties(m.FileBacking.Size, m.Size)
12951295
props = scaledProps.String()
12961296
}
12971297
if len(td.Input) == 0 {

internal/manifest/version.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,7 @@ func (m *TableMetadata) InitVirtual(isShared bool) {
354354
m.Virtual.Lower = m.Smallest
355355
m.Virtual.Upper = m.Largest
356356
m.Virtual.FileNum = m.FileNum
357-
m.Virtual.Size = m.Size
358357
m.Virtual.IsSharedIngested = isShared && m.SyntheticSeqNum() != 0
359-
m.Virtual.BackingSize = m.FileBacking.Size
360358
}
361359

362360
// Ref increments the table's ref count. If this is the table's first reference,

sstable/reader_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@ func runVirtualReaderTest(t *testing.T, path string, blockSize, indexBlockSize i
137137
}
138138
}()
139139

140-
formatVirtualReader := func(r *Reader, showProps bool, env ReadEnv) string {
140+
formatVirtualReader := func(r *Reader, showProps bool, env ReadEnv, backingSize, tableSize uint64) string {
141141
var b bytes.Buffer
142142
fmt.Fprintf(&b, "bounds: [%s-%s]\n", env.Virtual.Lower, env.Virtual.Upper)
143143
if showProps {
144144
fmt.Fprintf(&b, "filenum: %s\n", env.Virtual.FileNum.String())
145145
fmt.Fprintf(&b, "props:\n")
146-
p := r.Properties.GetScaledProperties(env.Virtual.BackingSize, env.Virtual.Size)
146+
p := r.Properties.GetScaledProperties(backingSize, tableSize)
147147
for _, line := range strings.Split(strings.TrimSpace(p.String()), "\n") {
148148
fmt.Fprintf(&b, " %s\n", line)
149149
}
@@ -205,15 +205,14 @@ func runVirtualReaderTest(t *testing.T, path string, blockSize, indexBlockSize i
205205
}
206206

207207
params.FileNum = nextFileNum()
208-
params.BackingSize = wMeta.Size
209208
env.Virtual = &params
210209

211210
var err error
212-
params.Size, err = r.EstimateDiskUsage(params.Lower.UserKey, params.Upper.UserKey, env)
211+
tableSize, err := r.EstimateDiskUsage(params.Lower.UserKey, params.Upper.UserKey, env)
213212
if err != nil {
214213
return err.Error()
215214
}
216-
return formatVirtualReader(r, showProps, env)
215+
return formatVirtualReader(r, showProps, env, wMeta.Size, tableSize)
217216

218217
case "compaction-iter":
219218
// Creates a compaction iterator from the virtual reader, and then

sstable/virtual/virtual_reader_params.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ type VirtualReaderParams struct {
88
Upper base.InternalKey
99
FileNum base.FileNum
1010
IsSharedIngested bool
11-
// Size is an estimate of the size of the [Lower, Upper) section of the table.
12-
Size uint64
13-
// BackingSize is the total size of the backing table. The ratio between Size
14-
// and BackingSize is used to estimate statistics.
15-
BackingSize uint64
1611
}
1712

1813
// Constrain bounds will narrow the start, end bounds if they do not fit within

table_stats.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ func (d *DB) loadTableStats(
308308
context.TODO(), block.NoReadEnv, meta, func(r *sstable.Reader, env sstable.ReadEnv) (err error) {
309309
props := r.Properties.CommonProperties
310310
if meta.Virtual != nil {
311-
props = r.Properties.GetScaledProperties(env.Virtual.BackingSize, env.Virtual.Size)
311+
props = r.Properties.GetScaledProperties(meta.FileBacking.Size, meta.Size)
312312
}
313313
stats.NumEntries = props.NumEntries
314314
stats.NumDeletions = props.NumDeletions

0 commit comments

Comments
 (0)