mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
move directory scan outside of the loop
Signed-off-by: Patryk Prus <p@trykpr.us>
This commit is contained in:
parent
49814ab96e
commit
72d1fc4322
|
@ -74,6 +74,11 @@ func (h *Head) loadWAL(r *wlog.Reader, syms *labels.SymbolTable, multiRef map[ch
|
||||||
decodeErr, seriesCreationErr error
|
decodeErr, seriesCreationErr error
|
||||||
)
|
)
|
||||||
|
|
||||||
|
_, last, err := wlog.Segments(h.wal.Dir())
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to get last segment to mark duplicate series as deleted: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
// For CorruptionErr ensure to terminate all workers before exiting.
|
// For CorruptionErr ensure to terminate all workers before exiting.
|
||||||
_, ok := err.(*wlog.CorruptionErr)
|
_, ok := err.(*wlog.CorruptionErr)
|
||||||
|
@ -237,12 +242,7 @@ Outer:
|
||||||
}
|
}
|
||||||
if !created {
|
if !created {
|
||||||
multiRef[walSeries.Ref] = mSeries.ref
|
multiRef[walSeries.Ref] = mSeries.ref
|
||||||
|
|
||||||
// Mark the walSeries as deleted, so it is kept in subsequent WAL checkpoints.
|
// Mark the walSeries as deleted, so it is kept in subsequent WAL checkpoints.
|
||||||
_, last, err := wlog.Segments(h.wal.Dir())
|
|
||||||
if err != nil {
|
|
||||||
h.logger.Error("failed to get last segment to mark duplicate series as deleted", "err", err)
|
|
||||||
}
|
|
||||||
h.markDeleted(walSeries.Ref, last)
|
h.markDeleted(walSeries.Ref, last)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue