Re:SQLite is not a toy database
by tmountain on Thursday March 25, 2021 @12:06PM
(#26581972)
How do backups work? Is there a locking mechanism to prevent file corruption if the file is copied during writing?
[ Parent
| on HN ]
It supports multiple readers, and writes are atomic - no reader should ever get corrupt data just because there is a write happening in parallel. You probably should not use the OS to copy the live db file, rather, have an in-process thread that reads the db and writes to a backup location periodically.
Exactly, many forget the little detail that they should use the backup feature, rather than just copy the database file.