Bound SQLite startup contention and serialize schema migration #6
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
kaiba/nixos-kaiba-network!6
Loading…
Reference in a new issue
No description provided.
Delete branch "codex/sqlite-concurrent-startup"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Concurrent DNS-store startup can exhaust the five-second WAL retry window while another process is initializing the database. The Fleet identity build failed with seven
SQLITE_BUSYerrors inTestSQLiteConcurrentOpenMigratesOnce; that test took 16.89 seconds. The precise CI interleaving has not been reproduced, but a separate process holding the database writer for six seconds reproduces the same startup failure against the current main branch.Give configuration and migration one 30-second contention budget, with context-aware waiting and no nested SQLite busy wait. Verify that WAL was actually selected. Acquire the SQLite writer before schema inspection and commit the complete migration atomically, so concurrent services see the committed schema and failed migrations do not publish partial tables. Normal operations retain the five-second busy timeout,
synchronous=FULL, foreign-key enforcement and existing shared-file permissions. Non-contention errors still fail immediately; the database schema and idempotency contract are unchanged.Validation: the full DNS Go test suite and store race tests pass using Go 1.26.5 and the locked vendor dependencies. Regression tests cover a six-second lock held by another process, expiration while a lock remains held, reopening after failure, invalid-database preservation, concurrent legacy migration with exact response retention, and atomic rollback after a migration error. The lock-release and atomic-rollback tests both fail against
cd518bfand pass with this change. Existing required CI jobs and their timeouts are unchanged. Deployment and Fleet dependency-pin updates follow only after the protected CI gates pass and this change merges.