> Richard Hipp wrote:
> Do you know if the corruption is occurring when TimeMachine makes its 
> backup, or is occurring when the backed up database is restored?  Can 
> you capture some unrestored TimeMachine backups to see if they are 
> corrupt? 
> 
> Can you send us one of your corrupted database files for analysis? 

Unfortunately, I do not know when exactly the corruption occurs. I will send
you an example of a corrupted database in a separate email.

> Olivier Mascia wrote:
> 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. 

The reasoning for using WAL is actually to reduce the number of changes to
the main database. Given that our main DB can be ~100 MB in size, having a
WAL reduces the number of times the main DB needs to change, which would
cause a new copy to be made in the Time Machine backup, increasing its size.
That's also why we allow the WAL to grow up to ~8 MB.

> My best guess here is that TimeMachine somehow captures the sqlite DB 
> files a few milliseconds apart "sometimes" so that a journal file that 
> has just been committed is in the TimeMachine backup captured still in 
> its uncommitted state while the DB itself is in the committed state 
> already (or perhaps vice-versa). 

A corruption due to a race condition between updating the main DB and WAL
_should_ be unlikely: We only do one save per minute, and the WAL only gets
checkpointed into the main DB every few hours. So Time Machine would need to
pass over those two files exactly when a checkpointing operation takes
place, which is fairly unlikely.

> Scott Perry wrote:
> Out of curiosity, why aren't you using the SQLite that comes with the OS? 

Using a newer version of SQLite should give us slightly better performance,
especially on older macOS versions (e.g. 10.11). Also, it might have been
easier to link our Swift app with a custom copy of the library than with the
OS-provided one, but I'm not sure about that.



--
Sent from: http://sqlite.1065341.n5.nabble.com/
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to