mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/mergeset: start assisted merge for file parts only if the number of file parts is bigger than maxFileParts
The maxFileParts usage has been accidentally removed in fa566c68a6
While at it, add Count suffix to *AssistedMerges counter names in order to make them less misleading.
Previously their names were falsely suggesting that these are gauges, which show the number of concurrently
executed assisted merges.
This commit is contained in:
parent
ac5b740750
commit
18df07e824
2 changed files with 11 additions and 11 deletions
|
@ -499,8 +499,8 @@ func writeStorageMetrics(w io.Writer, strg *storage.Storage) {
|
|||
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="indexdb/inmemory"}`, idbm.InmemoryAssistedMerges)
|
||||
metrics.WriteCounterUint64(w, `vm_assisted_merges_total{type="indexdb/file"}`, idbm.FileAssistedMerges)
|
||||
metrics.WriteCounterUint64(w, `vm_assisted_merges_total{type="indexdb/inmemory"}`, idbm.InmemoryAssistedMergesCount)
|
||||
metrics.WriteCounterUint64(w, `vm_assisted_merges_total{type="indexdb/file"}`, idbm.FileAssistedMergesCount)
|
||||
|
||||
metrics.WriteCounterUint64(w, `vm_indexdb_items_added_total`, idbm.ItemsAdded)
|
||||
metrics.WriteCounterUint64(w, `vm_indexdb_items_added_size_bytes_total`, idbm.ItemsAddedSizeBytes)
|
||||
|
|
|
@ -110,8 +110,8 @@ type Table struct {
|
|||
inmemoryItemsMerged uint64
|
||||
fileItemsMerged uint64
|
||||
|
||||
inmemoryAssistedMerges uint64
|
||||
fileAssistedMerges uint64
|
||||
inmemoryAssistedMergesCount uint64
|
||||
fileAssistedMergesCount uint64
|
||||
|
||||
itemsAdded uint64
|
||||
itemsAddedSizeBytes uint64
|
||||
|
@ -422,8 +422,8 @@ type TableMetrics struct {
|
|||
InmemoryItemsMerged uint64
|
||||
FileItemsMerged uint64
|
||||
|
||||
InmemoryAssistedMerges uint64
|
||||
FileAssistedMerges uint64
|
||||
InmemoryAssistedMergesCount uint64
|
||||
FileAssistedMergesCount uint64
|
||||
|
||||
ItemsAdded uint64
|
||||
ItemsAddedSizeBytes uint64
|
||||
|
@ -473,8 +473,8 @@ func (tb *Table) UpdateMetrics(m *TableMetrics) {
|
|||
m.InmemoryItemsMerged += atomic.LoadUint64(&tb.inmemoryItemsMerged)
|
||||
m.FileItemsMerged += atomic.LoadUint64(&tb.fileItemsMerged)
|
||||
|
||||
m.InmemoryAssistedMerges += atomic.LoadUint64(&tb.inmemoryAssistedMerges)
|
||||
m.FileAssistedMerges += atomic.LoadUint64(&tb.fileAssistedMerges)
|
||||
m.InmemoryAssistedMergesCount += atomic.LoadUint64(&tb.inmemoryAssistedMergesCount)
|
||||
m.FileAssistedMergesCount += atomic.LoadUint64(&tb.fileAssistedMergesCount)
|
||||
|
||||
m.ItemsAdded += atomic.LoadUint64(&tb.itemsAdded)
|
||||
m.ItemsAddedSizeBytes += atomic.LoadUint64(&tb.itemsAddedSizeBytes)
|
||||
|
@ -792,7 +792,7 @@ func (tb *Table) assistedMergeForInmemoryParts() {
|
|||
return
|
||||
}
|
||||
|
||||
atomic.AddUint64(&tb.inmemoryAssistedMerges, 1)
|
||||
atomic.AddUint64(&tb.inmemoryAssistedMergesCount, 1)
|
||||
|
||||
maxOutBytes := tb.getMaxFilePartSize()
|
||||
|
||||
|
@ -812,13 +812,13 @@ func (tb *Table) assistedMergeForInmemoryParts() {
|
|||
|
||||
func (tb *Table) assistedMergeForFileParts() {
|
||||
tb.partsLock.Lock()
|
||||
needMerge := getNotInMergePartsCount(tb.fileParts) >= defaultPartsToMerge
|
||||
needMerge := len(tb.fileParts) > maxFileParts && getNotInMergePartsCount(tb.fileParts) >= defaultPartsToMerge
|
||||
tb.partsLock.Unlock()
|
||||
if !needMerge {
|
||||
return
|
||||
}
|
||||
|
||||
atomic.AddUint64(&tb.fileAssistedMerges, 1)
|
||||
atomic.AddUint64(&tb.fileAssistedMergesCount, 1)
|
||||
err := tb.mergeExistingParts(false)
|
||||
if err == nil {
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue