2 ms·
You need to be running the database on a correctly working operating system. Since the database relies on the system calls like fsync() working correctly, the f
by Annatar 5y ago
You need to be running the database on a correctly working operating system. Since the database relies on the system calls like fsync() working correctly, the filesystem must also work correctly, the stable storage must have write caching turned off and write requests must not return before they are complete. Also, the operating system must not overcommit memory.
So in order to avoid SQLite database corruption, you need:
- hardware RAID disabled or reconfigured in JBOD ("IT") mode;
- RAID controller write cache disabled;
- RAID battery back-up cache disabled;
- individual drives' write caches disabled;
- ZFS;
- if using GNU/Linux, OOM turned off.
Even with turning off OOM, GNU/Linux's fsync() will still lie about I/O having completed, when it is in fact in transit. Therefore, if you want a reliable database, you must switch to a real UNIX, like SmartOS.
Only when all of these are done exactly as I have specified will you have a system ready for a relational database management system, and only then will a database be able to actually provide transactions.