From 0715f1efcdc8edcbaaba4224cb6c068ad90ef97a Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Thu, 25 Jan 2024 10:18:37 +0200 Subject: [PATCH] lib/storage: rename *AssistedMerges to *AssistedMergesCount in order to make these field names less misleading These fields are counters, not gauges, so adding Count suffix to them makes easier to understand this while reading the code --- app/vmstorage/main.go | 4 ++-- lib/storage/partition.go | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/vmstorage/main.go b/app/vmstorage/main.go index 916c97fe1..ca6e47990 100644 --- a/app/vmstorage/main.go +++ b/app/vmstorage/main.go @@ -421,8 +421,8 @@ func writeStorageMetrics(w io.Writer, strg *storage.Storage) { metrics.WriteCounterUint64(w, `vm_composite_filter_success_conversions_total`, idbm.CompositeFilterSuccessConversions) metrics.WriteCounterUint64(w, `vm_composite_filter_missing_conversions_total`, idbm.CompositeFilterMissingConversions) - metrics.WriteCounterUint64(w, `vm_assisted_merges_total{type="storage/inmemory"}`, tm.InmemoryAssistedMerges) - metrics.WriteCounterUint64(w, `vm_assisted_merges_total{type="storage/small"}`, tm.SmallAssistedMerges) + metrics.WriteCounterUint64(w, `vm_assisted_merges_total{type="storage/inmemory"}`, tm.InmemoryAssistedMergesCount) + metrics.WriteCounterUint64(w, `vm_assisted_merges_total{type="storage/small"}`, tm.SmallAssistedMergesCount) metrics.WriteCounterUint64(w, `vm_assisted_merges_total{type="indexdb/inmemory"}`, idbm.InmemoryAssistedMergesCount) metrics.WriteCounterUint64(w, `vm_assisted_merges_total{type="indexdb/file"}`, idbm.FileAssistedMergesCount) diff --git a/lib/storage/partition.go b/lib/storage/partition.go index 8861a0afa..66866a309 100644 --- a/lib/storage/partition.go +++ b/lib/storage/partition.go @@ -117,8 +117,8 @@ type partition struct { smallRowsDeleted uint64 bigRowsDeleted uint64 - inmemoryAssistedMerges uint64 - smallAssistedMerges uint64 + inmemoryAssistedMergesCount uint64 + smallAssistedMergesCount uint64 mergeIdx uint64 @@ -350,8 +350,8 @@ type partitionMetrics struct { SmallPartsRefCount uint64 BigPartsRefCount uint64 - InmemoryAssistedMerges uint64 - SmallAssistedMerges uint64 + InmemoryAssistedMergesCount uint64 + SmallAssistedMergesCount uint64 } // TotalRowsCount returns total number of rows in tm. @@ -415,8 +415,8 @@ func (pt *partition) UpdateMetrics(m *partitionMetrics) { m.SmallRowsDeleted += atomic.LoadUint64(&pt.smallRowsDeleted) m.BigRowsDeleted += atomic.LoadUint64(&pt.bigRowsDeleted) - m.InmemoryAssistedMerges += atomic.LoadUint64(&pt.inmemoryAssistedMerges) - m.SmallAssistedMerges += atomic.LoadUint64(&pt.smallAssistedMerges) + m.InmemoryAssistedMergesCount += atomic.LoadUint64(&pt.inmemoryAssistedMergesCount) + m.SmallAssistedMergesCount += atomic.LoadUint64(&pt.smallAssistedMergesCount) } // AddRows adds the given rows to the partition pt. @@ -641,7 +641,7 @@ func (pt *partition) assistedMergeForInmemoryParts() { return } - atomic.AddUint64(&pt.inmemoryAssistedMerges, 1) + atomic.AddUint64(&pt.inmemoryAssistedMergesCount, 1) err := pt.mergeInmemoryParts() if err == nil { return @@ -660,7 +660,7 @@ func (pt *partition) assistedMergeForSmallParts() { return } - atomic.AddUint64(&pt.smallAssistedMerges, 1) + atomic.AddUint64(&pt.smallAssistedMergesCount, 1) err := pt.mergeExistingParts(false) if err == nil { return