mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-10 15:14:09 +00:00
lib/mergeset: properly reset bsr.bhIdx after the call to blockStreamReader.readNextBHS()
The issue has been introduced in 58b40f514c
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3343
This commit is contained in:
parent
c8d7e1312c
commit
b0b8f05fa4
2 changed files with 3 additions and 2 deletions
|
@ -167,7 +167,7 @@ func unmarshalBlockHeadersNoCopy(dst []blockHeader, src []byte, blockHeadersCoun
|
|||
for i := 0; i < blockHeadersCount; i++ {
|
||||
tail, err := dst[dstLen+i].UnmarshalNoCopy(src)
|
||||
if err != nil {
|
||||
return dst, fmt.Errorf("cannot unmarshal block header: %w", err)
|
||||
return dst, fmt.Errorf("cannot unmarshal block header #%d out of %d: %w", i, blockHeadersCount, err)
|
||||
}
|
||||
src = tail
|
||||
}
|
||||
|
|
|
@ -297,8 +297,9 @@ func (bsr *blockStreamReader) readNextBHS() error {
|
|||
// Unmarshal the unpacked index block into bsr.bhs.
|
||||
bsr.bhs, err = unmarshalBlockHeadersNoCopy(bsr.bhs[:0], bsr.unpackedBuf, int(mr.blockHeadersCount))
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot unmarshal blockHeader #%d in the index block #%d: %w", len(bsr.bhs), bsr.mrIdx, err)
|
||||
return fmt.Errorf("cannot unmarshal blockHeaders in the index block #%d: %w", bsr.mrIdx, err)
|
||||
}
|
||||
bsr.bhIdx = 0
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue