Executing "PRAGMA journal_mode" may delete journal file while it is in use.
|User & Date:||dan 2010-06-17 10:45:24|
- Change comment to:
If "PRAGMA journal_mode" is used to change a connection from TRUNCATE or PERSIST mode to WAL, MEMORY, OFF or DELETE mode, the journal file is deleted. Even if it is currently being used by another connection (possibly in another process).
On unix, if that other connection (possibly in another process) is executing a write transaction when this happens, and the process exits unexpectedly for some reason, there will be no hot-journal file left in the file-system. If the connection had begun writing to the database file before the unexpected exit, the database may be left in a corrupt state.
dan added on 2010-06-17 09:52:50:
Introduced in commit [b78e58ae15].
dan added on 2010-06-17 10:44:33:
The fix checked in for this ([1ec74591a9]) is sub-optimal in the sense that if a writer changes from "PRAGMA journal_mode=PERSIST" to "PRAGMA journal_mode=MEMORY", the journal file will never be removed from the file-system. It is not hot (as the first part of it is zeroed), but SQLite will be forced to open and close the file at the start of every read or write transaction to verify this.