mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 20:37:12 +01: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
c3362e3db4
commit
a75137c1c2
@ -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 New Issue
Block a user