lib/mergeset: properly calculate global metrics in UpdateStats()

Previously these metrics could be calculated multiple times for multiple mergeset.Table instances.
This commit is contained in:
Aliaksandr Valialkin 2020-07-23 00:28:17 +03:00
parent 228d137936
commit 9224ede54f

View file

@ -337,11 +337,11 @@ func (tb *Table) UpdateMetrics(m *TableMetrics) {
}
tb.partsLock.Unlock()
m.DataBlocksCacheRequests += atomic.LoadUint64(&historicalDataBlockCacheRequests)
m.DataBlocksCacheMisses += atomic.LoadUint64(&historicalDataBlockCacheMisses)
m.DataBlocksCacheRequests = atomic.LoadUint64(&historicalDataBlockCacheRequests)
m.DataBlocksCacheMisses = atomic.LoadUint64(&historicalDataBlockCacheMisses)
m.IndexBlocksCacheRequests += atomic.LoadUint64(&historicalIndexBlockCacheRequests)
m.IndexBlocksCacheMisses += atomic.LoadUint64(&historicalIndexBlockCacheMisses)
m.IndexBlocksCacheRequests = atomic.LoadUint64(&historicalIndexBlockCacheRequests)
m.IndexBlocksCacheMisses = atomic.LoadUint64(&historicalIndexBlockCacheMisses)
}
// AddItems adds the given items to the tb.