Files
OmniRoute/tests
diegosouzapw 39d0a97d0b fix(db): reconcile INCREMENTAL auto_vacuum drift via the vacuum scheduler (#13432)
Migration 046 seeds databaseSettings.autoVacuumMode="INCREMENTAL" into the
key_value config store for every database it runs against (new and
pre-existing), but never touches the live SQLite auto_vacuum pragma — that
requires a VACUUM, which the migration correctly avoids running blindly.
The only automatic startup path deliberately skipped applying it too (to
avoid a blocking VACUUM at boot, the hazard #12821 tracks), with no drift
detection or self-correction, so the config permanently reported INCREMENTAL
while the live pragma stayed NONE.

Fix: applyStoredDatabaseOptimizationSettings() now detects the drift at
startup (log + persisted record, never a synchronous VACUUM), and
vacuumScheduler.runNow() reconciles it out-of-request on its next scheduled
run (announced one-time conversion VACUUM), then switches to a bounded
PRAGMA incremental_vacuum batch instead of an unconditional full VACUUM once
INCREMENTAL is actually in effect.

Regression test: tests/unit/issue-13432-auto-vacuum-drift.test.ts
2026-09-15 19:55:56 -03:00
..