TSDB: don't process exemplars older than minValidTime during WAL replay

Signed-off-by: Patryk Prus <p@trykpr.us>
This commit is contained in:
Patryk Prus 2025-03-19 16:24:08 -04:00
parent bc595263c1
commit 2f43a5a3ab
No known key found for this signature in database
GPG Key ID: 795650115CA6A58F

View File

@ -142,10 +142,6 @@ func (h *Head) loadWAL(r *wlog.Reader, syms *labels.SymbolTable, multiRef map[ch
missingSeries[e.Ref] = struct{}{}
continue
}
if e.T < h.minValidTime.Load() {
continue
}
// At the moment the only possible error here is out of order exemplars, which we shouldn't see when
// replaying the WAL, so lets just log the error if it's not that type.
err = h.exemplars.AddExemplar(ms.labels(), exemplar.Exemplar{Ts: e.T, Value: e.V, Labels: e.Labels})
@ -334,6 +330,9 @@ Outer:
h.wlReplaytStonesPool.Put(v)
case []record.RefExemplar:
for _, e := range v {
if e.T < h.minValidTime.Load() {
continue
}
if r, ok := multiRef[e.Ref]; ok {
e.Ref = r
}