mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 20:37:12 +01:00
lib/mergeset: cleanup after de6dd1cd5a
Remove unused getInmemoryPart and putInmemoryPart functions Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2249
This commit is contained in:
parent
b5b13e48a3
commit
d5df08e9c2
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user