From 2f43a5a3ab102f0ffd40c64ad9d4efcf69fe5c6e Mon Sep 17 00:00:00 2001 From: Patryk Prus
Date: Wed, 19 Mar 2025 16:24:08 -0400 Subject: [PATCH] TSDB: don't process exemplars older than minValidTime during WAL replay Signed-off-by: Patryk Prus
--- tsdb/head_wal.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tsdb/head_wal.go b/tsdb/head_wal.go index e97f06a2ce..51a2cb5ee8 100644 --- a/tsdb/head_wal.go +++ b/tsdb/head_wal.go @@ -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 }