Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

fix: run retention before auto-vacuum migration to reduce VACUUM cost

rcourtmanc2d2e7de0e59
diff --git a/pkg/metrics/store.go b/pkg/metrics/store.go
index aa40abab74..55e6497fc6 100644
--- a/pkg/metrics/store.go
+++ b/pkg/metrics/store.go
@@ -137,14 +137,16 @@ func NewStore(config StoreConfig) (*Store, error) {
return nil, fmt.Errorf("failed to initialize schema: %w", err)
}
- // Migrate existing databases to incremental auto-vacuum. This is a one-time
- // operation that restructures the file so deleted pages can be reclaimed.
- store.migrateAutoVacuum()
-
// Clean up stale data from previous runs before starting the background worker.
// This prevents accumulation if Pulse was restarted before hourly retention ran.
+ // Runs BEFORE auto-vacuum migration so the VACUUM operates on a much smaller
+ // dataset (e.g. 60MB of live data instead of 5GB of stale + live).
store.runRetention()
+ // Migrate existing databases to incremental auto-vacuum. This is a one-time
+ // operation that restructures the file so deleted pages can be reclaimed.
+ store.migrateAutoVacuum()
+
// Start background workers
go store.backgroundWorker()