Switch sqlite3 journal mode to WAL.

WAL mode does make the deadlocking on MacOS go away.  This suggests
that pysqlite3 was leaving *read* transactions open for a long time; in
old-style sqlite journals, this prevents anyone from obtaining a write
lock, although it doesn't prevent other concurrent reads.

With WAL journals, writes can happen even while readers are holding a
lock, but the journal doesn't flush until the readers have released it.
This is not a "real" fix but it's fairly harmless, since all redo
instances will exit eventually, and when they do, the WAL journal can
be flushed.
This commit is contained in:
Avery Pennarun 2018-10-06 05:06:42 -04:00
commit 5156feae9d

View file

@ -14,7 +14,7 @@ STAMP_MISSING='0' # the stamp of a nonexistent file
def _connect(dbfile): def _connect(dbfile):
_db = sqlite3.connect(dbfile, timeout=TIMEOUT) _db = sqlite3.connect(dbfile, timeout=TIMEOUT)
_db.execute("pragma synchronous = off") _db.execute("pragma synchronous = off")
_db.execute("pragma journal_mode = PERSIST") _db.execute("pragma journal_mode = WAL")
_db.text_factory = str _db.text_factory = str
return _db return _db