4 ms·
How do backups work? Is there a locking mechanism to prevent file corruption if the file is copied during writing?
by tmountain 6y ago
How do backups work? Is there a locking mechanism to prevent file corruption if the file is copied during writing?
- sangnoir 6y agoIt 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.
- mrweasel 6y agoExactly, many forget the little detail that they should use the backup feature, rather than just copy the database file.
- nijave 6y agoYou can also combine file system snapshots to get versioning which would allow you to pull the db file out of the latest snapshot (right after taking it) and send it somewhere