Merge pull request #17081 from prometheus/superq/if_err_nil

tsdb: Fixup err nil checks
This commit is contained in:
Bryan Boreham 2025-09-02 12:37:51 +01:00 committed by GitHub
commit 8e133e100f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 5 deletions

View File

@ -704,8 +704,7 @@ func (h *Head) Init(minValidTime int64) error {
snapshotLoaded = true
chunkSnapshotLoadDuration = time.Since(start)
h.logger.Info("Chunk snapshot loading time", "duration", chunkSnapshotLoadDuration.String())
}
if err != nil {
} else {
snapIdx, snapOffset = -1, 0
refSeries = make(map[chunks.HeadSeriesRef]*memSeries)

View File

@ -1443,12 +1443,10 @@ func (h *Head) performChunkSnapshot() error {
startTime := time.Now()
stats, err := h.ChunkSnapshot()
elapsed := time.Since(startTime)
if err == nil {
h.logger.Info("chunk snapshot complete", "duration", elapsed.String(), "num_series", stats.TotalSeries, "dir", stats.Dir)
}
if err != nil {
return fmt.Errorf("chunk snapshot: %w", err)
}
h.logger.Info("chunk snapshot complete", "duration", elapsed.String(), "num_series", stats.TotalSeries, "dir", stats.Dir)
return nil
}