Retry transient SQLITE_BUSY at migration Begin and race on a materialized db #139

Merged
weichen merged 1 commits from feature/collab-storage-pg-tier-fix2 into main 2026-10-11 04:09:01 +00:00
Owner

Follow-up to #137/#138: connection-open pragmas (journal_mode on first open) can fail SQLITE_BUSY immediately with no busy-handler coverage; bounded retry at Begin plus a pre-materialized racing test. Refs: Dev PR #325, plan KTD8.

Follow-up to #137/#138: connection-open pragmas (journal_mode on first open) can fail SQLITE_BUSY immediately with no busy-handler coverage; bounded retry at Begin plus a pre-materialized racing test. Refs: Dev PR #325, plan KTD8.
weichen added 1 commit 2026-10-11 04:09:00 +00:00
Why: the connection-open phase (DSN pragmas incl. journal_mode on first open) can return SQLITE_BUSY immediately - the busy handler does not cover that phase - so four racing migrators failed in 0.03s on slow CI disks regardless of the 30s timeout (jobs 2293/2285).

Evidence: local -count=30 green (fast disk) vs CI deterministic failure at 0.03s (no timeout wait occurred); fix verified with -count=5 locally plus full store suite.

Impact: bounded retry (5 attempts, backoff) on Begin BUSY only - statements inside the IMMEDIATE transaction remain lock-protected; the racing test now materializes the file/WAL first, matching the KTD8 scenario (concurrent migrators on a provisioned database).

Refs: Dev PR #325; plan KTD8.
weichen merged commit f480c5b520 into main 2026-10-11 04:09:01 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-System-Backend#139