Skip to content

Commit

Permalink
Don't crash on an unknown tombstone ref. (prometheus#604)
Browse files Browse the repository at this point in the history
Fixes prometheus#5562

Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
  • Loading branch information
brian-brazil authored and krasi-georgiev committed May 16, 2019
1 parent 63d9c2a commit 30d0ea5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions head.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,10 @@ func (h *Head) loadWAL(r *wal.Reader) error {
if itv.Maxt < h.minValidTime {
continue
}
if m := h.series.getByID(s.ref); m == nil {
unknownRefs++
continue
}
allStones.addInterval(s.ref, itv)
}
}
Expand Down
3 changes: 3 additions & 0 deletions head_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ func TestHead_ReadWAL(t *testing.T) {
{Ref: 10, T: 101, V: 5},
{Ref: 50, T: 101, V: 6},
},
[]Stone{
{ref: 0, intervals: []Interval{{Mint: 99, Maxt: 101}}},
},
}
dir, err := ioutil.TempDir("", "test_read_wal")
testutil.Ok(t, err)
Expand Down

0 comments on commit 30d0ea5

Please sign in to comment.