Fix SQLite WAL mode error on FUSE filesystems
WAL mode can fail on filesystems like mergerfs that don't fully support memory-mapped files. Add graceful fallback to DELETE journal mode. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
This commit is contained in:
@@ -245,7 +245,13 @@ def connect_db(path: Path | None = None) -> sqlite3.Connection:
|
|||||||
ensure_db_directory(db_path)
|
ensure_db_directory(db_path)
|
||||||
conn = sqlite3.connect(db_path)
|
conn = sqlite3.connect(db_path)
|
||||||
conn.row_factory = sqlite3.Row
|
conn.row_factory = sqlite3.Row
|
||||||
|
# WAL mode provides better concurrency but may not work on all filesystems
|
||||||
|
# (e.g., some FUSE filesystems like mergerfs). Fall back gracefully.
|
||||||
|
try:
|
||||||
conn.execute("PRAGMA journal_mode=WAL;")
|
conn.execute("PRAGMA journal_mode=WAL;")
|
||||||
|
except sqlite3.OperationalError:
|
||||||
|
# Fall back to DELETE journal mode which works everywhere
|
||||||
|
conn.execute("PRAGMA journal_mode=DELETE;")
|
||||||
conn.execute("PRAGMA foreign_keys=ON;")
|
conn.execute("PRAGMA foreign_keys=ON;")
|
||||||
return conn
|
return conn
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user