Run database maintenance under the database lock (closes #94) #97

Merged
clawbot merged 1 commits from issue-94-maintenance-lock into next 2026-10-19 13:26:37 +02:00
1 Commits
Author SHA1 Message Date
sneak d3c2e67787 Run database maintenance under the database lock (closes #94)
check / check (push) Waiting to run
Vacuum, Analyze and Checkpoint now take the database lock the batch
writes hold, so maintenance and batch writes wait for each other
instead of meeting at SQLite's write lock, where whichever waited past
the 5-second busy timeout failed with "database is locked". Analyze
runs ANALYZE through PRAGMA optimize, only on tables without statistics
or whose size changed tenfold, reading about 1000 rows of each index:
even limited, ANALYZE counts every index entry, so an hourly ANALYZE of
every table would hold the lock longer as the tables grow. The
analysis_limit=0 in Initialize, which set no limit, is gone.

Model: opus-5-5
2026-10-19 11:12:07 +00:00