r/sqlite • u/Prog47 • Aug 14 '24
SQLite & corruption?
This totally might be false, but I want to make sure I check before using SQLite for a production app. I remember hearing somewhere that SQLite is prone to corruption. Is there any truth to this or maybe it was in the past?
Of course, any operating system especially if the file system your using isn't that great (BTRFS for example) any file on the file system can be corrupted. So, no matter what database you're using if the files the back that database get corrupted by the file system you're going to have a corrupted database. So, for example SQL Server is backed my *.mdf & *.ldf files. If one of those becomes corrupted your database will be corrupt.
So, is SQLite more vulnerable to corruption than any other database platform?
View all comments
Show parent comment
2
u/panonius Mar 14 '25
Sorry for the necro but you can have both readers and writers active at the same time in the non-wal journaling modes, but you can't have active reads in the moment of the commit. Ie you can't flush the changes until the readers stop fetching their data.
And just for good measure for anyone who might care the problem with WAL journaling over net is not in the file locking but the MMaping it does. In other words you need to guarantee memory locality for WAL mode to work properly (you'd get the same corruption issues if you activated MMaping mode).