Avoid panic when the headChunk is nil during isolation.

Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
This commit is contained in:
Krasi Georgiev 2020-07-20 18:23:18 +03:00 committed by Ganesh Vernekar
parent c448ada63d
commit 9a75b5f84b
No known key found for this signature in database
GPG key ID: 0241A11211763456

View file

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