mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-24 20:52:51 +00:00
e2635c3810
Address the remaining verified findings from the pkg/metrics/store.go review (#2079 finding 5 and the lower-impact nits): - writeBatch now retries the whole transaction on a retryable lock error. BEGIN is deferred, so contention is hit at the first INSERT or COMMIT; the old loop retried only Begin() and skipped rows. While the one-time startup maintenance (deferred identity-index rebuild and auto-vacuum VACUUM) is active, an extended retry budget keeps upgrade-time history instead of dropping it after the steady-state budget. - migrateLegacyHostResourceType probes with an indexed EXISTS before opening a write transaction, so an already-migrated store does not dirty the WAL on every boot. - QueryAll caps the per-series MetricPoint preallocation so a fine requested step over a long range cannot reserve hundreds of thousands of slots. Regressions: TestStoreStartupMaintenanceSignalsWriteRetryBudget, TestStoreWriteBatchExtendsRetryDuringStartupMaintenance, TestEstimateQueryAllBatchSeriesCapacityCapsPreallocation. The performance-and-scalability contract records the invariants. Change-source: pulse-maintainer