mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2026-03-27 18:17:29 +01:00
fix: checkpoint initialization gap on restarts
Entire-Checkpoint: 3f4d366b037c
This commit is contained in:
@@ -53,6 +53,16 @@ func cleanUpWorker(wg *sync.WaitGroup, ctx context.Context, interval string, mod
|
||||
return
|
||||
}
|
||||
|
||||
// Account for checkpoint span: files named {from}.bin contain data up to
|
||||
// from+checkpointInterval. Subtract the checkpoint interval so we don't
|
||||
// delete files whose data still falls within the retention window.
|
||||
checkpointSpan := 12 * time.Hour
|
||||
if Keys.CheckpointInterval != "" {
|
||||
if parsed, err := time.ParseDuration(Keys.CheckpointInterval); err == nil {
|
||||
checkpointSpan = parsed
|
||||
}
|
||||
}
|
||||
|
||||
ticker := time.NewTicker(d)
|
||||
defer ticker.Stop()
|
||||
|
||||
@@ -61,7 +71,7 @@ func cleanUpWorker(wg *sync.WaitGroup, ctx context.Context, interval string, mod
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case <-ticker.C:
|
||||
t := time.Now().Add(-d)
|
||||
t := time.Now().Add(-d).Add(-checkpointSpan)
|
||||
cclog.Infof("[METRICSTORE]> start %s checkpoints (older than %s)...", mode, t.Format(time.RFC3339))
|
||||
|
||||
n, err := CleanupCheckpoints(Keys.Checkpoints.RootDir, cleanupDir, t.Unix(), delete)
|
||||
|
||||
Reference in New Issue
Block a user