mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/mergeset: fill partHeader.firstItem on first block flush
This commit is contained in:
parent
3d83f5d334
commit
51a21c7d4b
1 changed files with 4 additions and 5 deletions
|
@ -95,11 +95,6 @@ again:
|
||||||
|
|
||||||
bsr := heap.Pop(&bsm.bsrHeap).(*blockStreamReader)
|
bsr := heap.Pop(&bsm.bsrHeap).(*blockStreamReader)
|
||||||
|
|
||||||
if !bsm.phFirstItemCaught {
|
|
||||||
ph.firstItem = append(ph.firstItem[:0], bsr.Block.items[0]...)
|
|
||||||
bsm.phFirstItemCaught = true
|
|
||||||
}
|
|
||||||
|
|
||||||
var nextItem []byte
|
var nextItem []byte
|
||||||
hasNextItem := false
|
hasNextItem := false
|
||||||
if len(bsm.bsrHeap) > 0 {
|
if len(bsm.bsrHeap) > 0 {
|
||||||
|
@ -142,6 +137,10 @@ func (bsm *blockStreamMerger) flushIB(bsw *blockStreamWriter, ph *partHeader, it
|
||||||
itemsCount := uint64(len(bsm.ib.items))
|
itemsCount := uint64(len(bsm.ib.items))
|
||||||
ph.itemsCount += itemsCount
|
ph.itemsCount += itemsCount
|
||||||
atomic.AddUint64(itemsMerged, itemsCount)
|
atomic.AddUint64(itemsMerged, itemsCount)
|
||||||
|
if !bsm.phFirstItemCaught {
|
||||||
|
ph.firstItem = append(ph.firstItem[:0], bsm.ib.items[0]...)
|
||||||
|
bsm.phFirstItemCaught = true
|
||||||
|
}
|
||||||
ph.lastItem = append(ph.lastItem[:0], bsm.ib.items[len(bsm.ib.items)-1]...)
|
ph.lastItem = append(ph.lastItem[:0], bsm.ib.items[len(bsm.ib.items)-1]...)
|
||||||
bsw.WriteBlock(&bsm.ib)
|
bsw.WriteBlock(&bsm.ib)
|
||||||
bsm.ib.Reset()
|
bsm.ib.Reset()
|
||||||
|
|
Loading…
Reference in a new issue