Skip to content

db: incorporate blob files into EstimateDiskUsage #4621

Closed
@jbowens

Description

@jbowens

When estimating the disk usage between two bounds, we should incorporate contribution from blob files referenced from overlapping sstables. When there's partial overlap with a sstable, we don't have a means of accurately determining how much of a blob reference comes from the span passed into EstimateDiskUsage specifically. I suppose we could crudely estimate it using linear interpolation.

We use (*sstable.Reader).EstimateDiskUsage(start, end) to get an accurate estimate of the disk usage within the sstable itself. We divide that by the TableMetadata.Size to get an estimate of the fraction of the table's blob references that fall within the range. Then for each blob reference, we scale the uncompressd ValueLen by that fraction to get estimates of the uncompressed value quantities. Then we scale each of those by the compression ratio of the blob file and sum them all together.

Jira issue: PEBBLE-424

Epic CRDB-20379

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions