Merge pull request #16242 from pr00se/drop-exemplars-sooner

TSDB: don't process exemplars older than minValidTime during WAL replay
This commit is contained in:
Bryan Boreham 2025-03-20 14:09:00 +00:00 committed by GitHub
commit eac37157ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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
}