Skip to main content

reclaim

Function reclaim 

Source
pub async fn reclaim(pool: &SqlitePool) -> Result<()>
Expand description

Reclaim freed pages so the database file (and its used-page accounting) can actually shrink after a retention/prune sweep DELETEs rows.

Without this, a DELETE moves pages onto the freelist but never shrinks the file — so once the DB-size watermark trips and retention deletes rows, page_count stays put and db_size_bytes (well, its raw page_count form) would never fall back below the watermark, latching the poller off forever. Call this AFTER a prune. It uses incremental vacuum when the database is in auto_vacuum = INCREMENTAL mode (cheap, no full rewrite), and otherwise falls back to a full VACUUM.