3 ms·
Writing a copy and renaming works, but is it the only way, or is it just an approach that a lot of software uses because it's simple and it works? In other word
by adrianmonk 7y ago
Writing a copy and renaming works, but is it the only way, or is it just an approach that a lot of software uses because it's simple and it works? In other words, are there ways that might be more work to implement but also more efficient that would be suitable for a database?
I agree the risk is pretty small in practice. Though copying with File Explorer isn't the use case I had in mind. It was automatic scheduled backups. Both Windows and macOS make it pretty easy to set these up with an external hard drive. And those could start running while you're using the computer and/or you could start using the computer while backups are running.
- lolc 7y agoAn append-only format should work fine with most backup software that copies files. A vacuum phase would still have to do an atomic rename.
- GlitchMr 7y agoBack-up software can use NTFS/ReFS Shadow Copy in Windows. This shouldn't cause issues with SQLite. Copying files is only an issue for manual back-ups done without special software.
- zlynx 7y agoSome backup software gets the modification time of the file, does the copy, then checks the modification time again. If it changed then it recopies the file. If it exceeds some number of attempts it gives up and reports an error for the file.