@@ -1344,19 +1344,19 @@ type MetricsForInterval struct {
13441344// NumSSTables returns the total number of SSTables in the LSM, aggregated
13451345// across levels.
13461346func (m * Metrics ) NumSSTables () int64 {
1347- var num int64
1347+ var num uint64
13481348 for _ , lm := range m .Metrics .Levels {
1349- num += lm .TablesCount
1349+ num += lm .Tables . Count
13501350 }
1351- return num
1351+ return int64 ( num )
13521352}
13531353
13541354// IngestedBytes returns the sum of all ingested tables, aggregated across all
13551355// levels of the LSM.
13561356func (m * Metrics ) IngestedBytes () uint64 {
13571357 var ingestedBytes uint64
13581358 for _ , lm := range m .Metrics .Levels {
1359- ingestedBytes += lm .TableBytesIngested
1359+ ingestedBytes += lm .TablesIngested . Bytes
13601360 }
13611361 return ingestedBytes
13621362}
@@ -1366,7 +1366,7 @@ func (m *Metrics) IngestedBytes() uint64 {
13661366func (m * Metrics ) CompactedBytes () (read , written uint64 ) {
13671367 for _ , lm := range m .Metrics .Levels {
13681368 read += lm .TableBytesRead + lm .BlobBytesRead
1369- written += lm .TableBytesCompacted + lm .BlobBytesCompacted
1369+ written += lm .TablesCompacted . Bytes + lm .BlobBytesCompacted
13701370 }
13711371 return read , written
13721372}
@@ -1401,32 +1401,32 @@ func (m *Metrics) AsStoreStatsEvent() eventpb.StoreStats {
14011401 WalPhysicalSize : m .WAL .PhysicalSize ,
14021402 WalBytesIn : m .WAL .BytesIn ,
14031403 WalBytesWritten : m .WAL .BytesWritten ,
1404- TableObsoleteCount : m .Table .ObsoleteCount ,
1405- TableObsoleteSize : m .Table .ObsoleteSize ,
1406- TableZombieCount : m .Table .ZombieCount ,
1407- TableZombieSize : m .Table .ZombieSize ,
1404+ TableObsoleteCount : int64 ( m .Table .Obsolete . All . Count ) ,
1405+ TableObsoleteSize : m .Table .Obsolete . All . Bytes ,
1406+ TableZombieCount : int64 ( m .Table .Zombie . All . Count ) ,
1407+ TableZombieSize : m .Table .Zombie . All . Bytes ,
14081408 RangeKeySetsCount : m .Keys .RangeKeySetsCount ,
14091409 }
14101410 e .CacheHits , e .CacheMisses = m .BlockCache .HitsAndMisses .Aggregate ()
14111411 for i , l := range m .Levels {
1412- if l .TablesCount == 0 {
1412+ if l .Tables . Count == 0 {
14131413 continue
14141414 }
14151415 e .Levels = append (e .Levels , eventpb.LevelStats {
14161416 Level : uint32 (i ),
1417- NumFiles : l . TablesCount ,
1418- SizeBytes : l . TablesSize ,
1417+ NumFiles : int64 ( l . Tables . Count ) ,
1418+ SizeBytes : int64 ( l . Tables . Bytes ) ,
14191419 Score : float32 (l .Score ),
14201420 BytesIn : l .TableBytesIn ,
1421- BytesIngested : l .TableBytesIngested ,
1422- BytesMoved : l .TableBytesMoved ,
1421+ BytesIngested : l .TablesIngested . Bytes ,
1422+ BytesMoved : l .TablesMoved . Bytes ,
14231423 BytesRead : l .TableBytesRead + l .BlobBytesRead ,
1424- BytesCompacted : l .TableBytesCompacted + l .BlobBytesCompacted ,
1425- BytesFlushed : l .TableBytesFlushed + l .BlobBytesFlushed ,
1426- TablesCompacted : l .TablesCompacted ,
1427- TablesFlushed : l .TablesFlushed ,
1428- TablesIngested : l .TablesIngested ,
1429- TablesMoved : l .TablesMoved ,
1424+ BytesCompacted : l .TablesCompacted . Bytes + l .BlobBytesCompacted ,
1425+ BytesFlushed : l .TablesFlushed . Bytes + l .BlobBytesFlushed ,
1426+ TablesCompacted : l .TablesCompacted . Count ,
1427+ TablesFlushed : l .TablesFlushed . Count ,
1428+ TablesIngested : l .TablesIngested . Count ,
1429+ TablesMoved : l .TablesMoved . Count ,
14301430 NumSublevels : l .Sublevels ,
14311431 })
14321432 }
@@ -1756,7 +1756,7 @@ func preIngestDelay(ctx context.Context, eng Engine, settings *cluster.Settings)
17561756 return
17571757 }
17581758 log .VEventf (ctx , 2 , "delaying SST ingestion %s. %d L0 files, %d L0 Sublevels" ,
1759- targetDelay , metrics .Levels [0 ].TablesCount , metrics .Levels [0 ].Sublevels )
1759+ targetDelay , metrics .Levels [0 ].Tables . Count , metrics .Levels [0 ].Sublevels )
17601760
17611761 select {
17621762 case <- time .After (targetDelay ):
@@ -1769,7 +1769,7 @@ func calculatePreIngestDelay(settings *cluster.Settings, metrics *pebble.Metrics
17691769 l0ReadAmpLimit := ingestDelayL0Threshold .Get (& settings .SV )
17701770
17711771 const ramp = 10
1772- l0ReadAmp := metrics .Levels [0 ].TablesCount
1772+ l0ReadAmp := int64 ( metrics .Levels [0 ].Tables . Count )
17731773 if metrics .Levels [0 ].Sublevels >= 0 {
17741774 l0ReadAmp = int64 (metrics .Levels [0 ].Sublevels )
17751775 }
0 commit comments