Dear Daniel,

I'm extracting two points out of your report:

> Le 11 déc. 2018 à 13:01, Daniel Alm <dan...@timingapp.com> a écrit :
> 
> While our app is running in the background all the time, it is not very 
> write-heavy (~ one transaction per minute taking just a few milliseconds).
> PRAGMA journal_mode = WAL;

When TimeMachine makes copies of the files, the database file and -wal file 
will be copied at different points in time, albeit they should be copied from a 
filesystem snapshot, so should be consistent to each other. But this should be 
checked, and verified for different macOS versions.

a) If only the database file is restored (and not its -wal file) or if both 
files are restored (but were not in synch when backed up) this might, rightly, 
trigger the database is malformed message.

As said on page https://www.sqlite.org/wal.html:

"The WAL file is part of the persistent state of the database and should be 
kept with the database if the database is copied or moved. If a database file 
is separated from its WAL file, then transactions that were previously 
committed to the database might be lost, or the database file might become 
corrupted. The only safe way to remove a WAL file is to open the database file 
using one of the sqlite3_open() interfaces then immediately close the database 
using sqlite3_close()."


b) Maybe using WAL is not really useful for your use-case, if really there is 
mostly one very short write transaction per minute.  The default journal mode 
might be perfectly adequate. But surely you chose WAL mode for some specific 
reason.  I just don't instantly spot which one from your report.


-- 
Best Regards, Meilleures salutations, Met vriendelijke groeten,
Olivier Mascia


_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to