Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

Commit 4ce2457

Browse files
authored
Merge pull request #871 from grafana/fix-gc-panic
fix panic in GC
2 parents fb2a833 + 82606b6 commit 4ce2457

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mdata/aggmetric.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,10 @@ func (a *AggMetric) add(ts uint32, val float64) {
573573
// caller must hold AggMetric lock
574574
func (a *AggMetric) collectable(now, chunkMinTs uint32) bool {
575575

576-
currentChunk := a.getChunk(a.CurrentChunkPos)
576+
var currentChunk *chunk.Chunk
577+
if len(a.Chunks) != 0 {
578+
currentChunk = a.getChunk(a.CurrentChunkPos)
579+
}
577580

578581
// no chunks at all means "possibly collectable"
579582
// the caller (AggMetric.GC()) still has its own checks to

0 commit comments

Comments
 (0)