Use WAL and durable connection defaults for SQLite#278
Use WAL and durable connection defaults for SQLite#278AnnoyingTechnology wants to merge 1 commit into
Conversation
755d2ba to
787109e
Compare
Configure file-backed SQLite databases for WAL with FULL synchronous writes, foreign-key enforcement, and an explicit busy timeout. Keep DELETE as the narrowly documented fallback for unsupported filesystems and verify every applied pragma in the SQLite test path.\n\nDocument WAL filesystem, backup, and patched-version requirements, including SQLite's WAL-reset advisory.
787109e to
e0841cf
Compare
|
Hi What problem did you run into with |
|
Hi, None. It's a default config improvement. With concurrent PHP workers, WAL is SQLite’s appropriate default (unless the fs doesn't support it), and a logical default change along with #273 |
Which is probably the case for most users self-hosting and running Davis on a NAS using NFS or SMB shares; so this default will not change. |
|
I don't see many cases where a user would access/expose their codebase+sqlite via NFS or SMB, especially when the data is light. But fair, I might be missing the actual userbase stack. Most self hosting I've seen (in general) is with VPS, EC2 (ebs is exposed as local), LXC + ZFS or QEMU + ZFS (pve stack), all of which benefit from WAL. |
Why
Davis currently leaves SQLite on its generic rollback-journal defaults. For a local, file-backed server database, WAL is the better application default: readers do not block a writer, a writer does not block readers, and writes are sequential. This matches the short multi-process requests produced by PHP and DAV clients.
The durability policy should remain explicit. This PR keeps
synchronous=FULLrather than trading committed writes for speed and makes the existing 60-second lock wait explicit.What changed
journal_mode=WALsynchronous=FULLbusy_timeout=60000explicitlySQLITE_JOURNAL_MODE=DELETEas the narrow fallbackForeign-key enforcement and the missing SQLite constraints live in the database-invariants PR, keeping the two connection concerns independently reviewable and clean when merged together.
Operational notes
The README states the local-filesystem requirement, safe live-backup behavior, and the documented WAL-reset bug, including fixed releases and backports. There is deliberately no brittle runtime version-string gate because distributions may backport the fix without changing SQLite upstream version numbers.
Verification
wal,synchronous=FULL, and a 60-second busy timeout