Avoid panic when the headChunk is nil during isolation.

Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
pull/7550/head
Krasi Georgiev 4 years ago
parent eaa522867e
commit d30492cbb0

@ -2208,10 +2208,8 @@ func (s *memSeries) iterator(id int, isoState *isolationState, chunkDiskMapper *
previousSamples += int(d.numSamples) previousSamples += int(d.numSamples)
} }
} }
// mmappedChunks does not contain the last chunk. Hence check it separately.
if len(s.mmappedChunks) < ix { if s.headChunk != nil {
previousSamples += s.headChunk.chunk.NumSamples()
} else {
totalSamples += s.headChunk.chunk.NumSamples() totalSamples += s.headChunk.chunk.NumSamples()
} }

Loading…
Cancel
Save