Log WAL replay duration

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
This commit is contained in:
Ganesh Vernekar 2020-03-03 19:41:14 +05:30 committed by Julien Pivotto
parent a128fc3534
commit 2cc32c332d

View file

@ -588,6 +588,7 @@ func (h *Head) Init(minValidTime int64) error {
}
level.Info(h.logger).Log("msg", "replaying WAL, this may take awhile")
start := time.Now()
// Backfill the checkpoint first if it exists.
dir, startFrom, err := wal.LastCheckpoint(h.wal.Dir())
if err != nil && err != record.ErrNotFound {
@ -638,6 +639,8 @@ func (h *Head) Init(minValidTime int64) error {
level.Info(h.logger).Log("msg", "WAL segment loaded", "segment", i, "maxSegment", last)
}
level.Info(h.logger).Log("msg", "WAL replay completed", "duration", time.Since(start).String())
return nil
}