4 ms·
Doesn't point 1.2 (backing up the file in the middle of a transaction) contradict the part above about how SQLite is resistant to power failures and simply roll
by andai 5y ago
Doesn't point 1.2 (backing up the file in the middle of a transaction) contradict the part above about how SQLite is resistant to power failures and simply rolls back the incomplete transaction? You'd just end up with a db outdated by 1 transaction, which is fine for a backup anyway.
- electroly 5y agoI'm not sure, but from the last sentence, it seems as though they're talking about what would happen if you backed it up but didn't also back up the journal or WAL. I think the bit about SQLite being resistant to power failures assumes that the journal or WAL are present. This is supported by the next section on "Deleting a hot journal" which says "SQLite must see the journal files in order to recover from a crash or power failure."
- account42 5y agoBesides the journal, live backups of the database file might not be atomic in which case the backed up copy could have content written after a fsync but missing content written before it which should not happen on power loss.