mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-10 18:45:53 +00:00
2b8ce06c03
runRetention reclaimed only PRAGMA incremental_vacuum(5000) (~20MB) and only when that hourly cycle deleted rows. On instances where an hourly retention pass frees more than 5000 pages, the freelist grows net-positive every cycle and the sqlite file bloats unboundedly (5GB+ of free pages over ~60MB of live data) even though row retention works. This is the documented '50+ resources -> 5GB+' symptom the 5000-page batch was meant to fix. Reclaim every cycle (so a pre-existing backlog drains even in a no-delete hour) and size each reclaim to the current freelist, capped at 50000 pages (~200MB) so a large backlog drains over several cycles without holding the write lock for minutes. Skip the checkpoint when the freelist is empty so steady-state WAL cadence is unchanged. Surfaced by the demo server (pulse-relay): metrics.db had grown to 5.9GB (5GB freelist), filling its 25GB disk and breaking the nightly backup. Adds TestStoreRetentionReclaimsFreePages to the perf-and-scalability proof set and documents the reclaim invariant in the subsystem contract.