From d5df08e9c228b8a8caa2b57e4c894f8a4a68f728 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin <valyala@victoriametrics.com> Date: Thu, 4 Aug 2022 18:22:41 +0300 Subject: [PATCH] lib/mergeset: cleanup after de6dd1cd5a69af41428ca3efda5aef43d3dd6ea3 Remove unused getInmemoryPart and putInmemoryPart functions Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2249 --- lib/mergeset/inmemory_part.go | 17 ----------------- lib/mergeset/table.go | 5 +---- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/lib/mergeset/inmemory_part.go b/lib/mergeset/inmemory_part.go index 6b4db2a464..9b41faca82 100644 --- a/lib/mergeset/inmemory_part.go +++ b/lib/mergeset/inmemory_part.go @@ -1,8 +1,6 @@ package mergeset import ( - "sync" - "github.com/VictoriaMetrics/VictoriaMetrics/lib/bytesutil" "github.com/VictoriaMetrics/VictoriaMetrics/lib/encoding" "github.com/VictoriaMetrics/VictoriaMetrics/lib/logger" @@ -90,18 +88,3 @@ func (mp *inmemoryPart) NewPart() *part { func (mp *inmemoryPart) size() uint64 { return uint64(len(mp.metaindexData.B) + len(mp.indexData.B) + len(mp.itemsData.B) + len(mp.lensData.B)) } - -func getInmemoryPart() *inmemoryPart { - v := inmemoryPartPool.Get() - if v == nil { - return &inmemoryPart{} - } - return v.(*inmemoryPart) -} - -func putInmemoryPart(mp *inmemoryPart) { - mp.Reset() - inmemoryPartPool.Put(mp) -} - -var inmemoryPartPool sync.Pool diff --git a/lib/mergeset/table.go b/lib/mergeset/table.go index b9e9f8c5b8..29448de6c8 100644 --- a/lib/mergeset/table.go +++ b/lib/mergeset/table.go @@ -738,7 +738,7 @@ func (tb *Table) mergeInmemoryBlocks(ibs []*inmemoryBlock) *partWrapper { } if len(bsrs) == 1 { // Nothing to merge. Just return a single inmemory part. - mp := getInmemoryPart() + mp := &inmemoryPart{} mp.Init(&bsrs[0].Block) p := mp.NewPart() return &partWrapper{ @@ -750,9 +750,6 @@ func (tb *Table) mergeInmemoryBlocks(ibs []*inmemoryBlock) *partWrapper { // Prepare blockStreamWriter for destination part. bsw := getBlockStreamWriter() - // Do not obtain mpDst via getInmemoryPart(), since its size - // may be too big comparing to other entries in the pool. - // This may result in increased memory usage because of high fragmentation. mpDst := &inmemoryPart{} bsw.InitFromInmemoryPart(mpDst)