@@ -2146,82 +2146,6 @@ func (d *DB) SSTables(opts ...SSTablesOption) ([][]SSTableInfo, error) {
2146
2146
return destLevels , nil
2147
2147
}
2148
2148
2149
- // makeFileSizeAnnotator returns an annotator that computes the total
2150
- // storage size of files that meet some criteria defined by filter. When
2151
- // applicable, this includes both the sstable size and the size of any
2152
- // referenced blob files.
2153
- func (d * DB ) makeFileSizeAnnotator (
2154
- filter func (f * manifest.TableMetadata ) bool ,
2155
- ) * manifest.TableAnnotator [uint64 ] {
2156
- return manifest.NewTableAnnotator [uint64 ](manifest.SumAggregator {
2157
- AccumulateFunc : func (f * manifest.TableMetadata ) (uint64 , bool ) {
2158
- if filter (f ) {
2159
- return f .Size + f .EstimatedReferenceSize (), true
2160
- }
2161
- return 0 , true
2162
- },
2163
- AccumulatePartialOverlapFunc : func (f * manifest.TableMetadata , bounds base.UserKeyBounds ) uint64 {
2164
- if filter (f ) {
2165
- overlappingFileSize , err := d .fileCache .estimateSize (f , bounds .Start , bounds .End .Key )
2166
- if err != nil {
2167
- return 0
2168
- }
2169
- overlapFraction := float64 (overlappingFileSize ) / float64 (f .Size )
2170
- // Scale the blob reference size proportionally to the file
2171
- // overlap from the bounds to approximate only the blob
2172
- // references that overlap with the requested bounds.
2173
- return overlappingFileSize + uint64 (float64 (f .EstimatedReferenceSize ())* overlapFraction )
2174
- }
2175
- return 0
2176
- },
2177
- })
2178
- }
2179
-
2180
- // EstimateDiskUsage returns the estimated filesystem space used in bytes for
2181
- // storing the range `[start, end]`. The estimation is computed as follows:
2182
- //
2183
- // - For sstables fully contained in the range the whole file size is included.
2184
- // - For sstables partially contained in the range the overlapping data block sizes
2185
- // are included. Even if a data block partially overlaps, or we cannot determine
2186
- // overlap due to abbreviated index keys, the full data block size is included in
2187
- // the estimation. Note that unlike fully contained sstables, none of the
2188
- // meta-block space is counted for partially overlapped files.
2189
- // - For virtual sstables, we use the overlap between start, end and the virtual
2190
- // sstable bounds to determine disk usage.
2191
- // - There may also exist WAL entries for unflushed keys in this range. This
2192
- // estimation currently excludes space used for the range in the WAL.
2193
- func (d * DB ) EstimateDiskUsage (start , end []byte ) (uint64 , error ) {
2194
- bytes , _ , _ , err := d .EstimateDiskUsageByBackingType (start , end )
2195
- return bytes , err
2196
- }
2197
-
2198
- // EstimateDiskUsageByBackingType is like EstimateDiskUsage but additionally
2199
- // returns the subsets of that size in remote ane external files.
2200
- func (d * DB ) EstimateDiskUsageByBackingType (
2201
- start , end []byte ,
2202
- ) (totalSize , remoteSize , externalSize uint64 , _ error ) {
2203
- if err := d .closed .Load (); err != nil {
2204
- panic (err )
2205
- }
2206
-
2207
- bounds := base .UserKeyBoundsInclusive (start , end )
2208
- if ! bounds .Valid (d .cmp ) {
2209
- return 0 , 0 , 0 , errors .New ("invalid key-range specified (start > end)" )
2210
- }
2211
-
2212
- // Grab and reference the current readState. This prevents the underlying
2213
- // files in the associated version from being deleted if there is a concurrent
2214
- // compaction.
2215
- readState := d .loadReadState ()
2216
- defer readState .unref ()
2217
-
2218
- totalSize = * d .mu .annotators .totalFileSize .VersionRangeAnnotation (readState .current , bounds )
2219
- remoteSize = * d .mu .annotators .remoteSize .VersionRangeAnnotation (readState .current , bounds )
2220
- externalSize = * d .mu .annotators .externalSize .VersionRangeAnnotation (readState .current , bounds )
2221
-
2222
- return
2223
- }
2224
-
2225
2149
func (d * DB ) walPreallocateSize () int {
2226
2150
// Set the WAL preallocate size to 110% of the memtable size. Note that there
2227
2151
// is a bit of apples and oranges in units here as the memtabls size
0 commit comments