lib/mergeset: cleanup after de6dd1cd5a

Remove unused getInmemoryPart and putInmemoryPart functions

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2249
This commit is contained in:
Aliaksandr Valialkin 2022-08-04 18:22:41 +03:00
parent b5b13e48a3
commit d5df08e9c2
No known key found for this signature in database
GPG Key ID: A72BEC6CD3D0DED1
2 changed files with 1 additions and 21 deletions

View File

@ -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

View File

@ -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)