3 ms·
The WAL is append-only so you don't risk data corruption (which is great). I'm not sure this is true with all filesystems. I think there are some filesystems
by aidenn0 4y ago
The WAL is append-only so you don't risk data corruption (which is great).
I'm not sure this is true with all filesystems. I think there are some filesystems in which a crash during append can end up with the file enlarged, but the data not written (IIRC I saw something like this with XFS when I was working on a kernel module that kept crashing the kernel).
- benbjohnson 4y ago> I think there are some filesystems in which a crash during append can end up with the file enlarged The SQLite WAL file itself has a running checksum that starts from the beginning so if you had an enlarged file or even a block of zero'd out bytes in the middle, SQLite would still recover gracefully. It recovers up to the last valid WAL frame that contains a set "commit" flag.
- aidenn0 4y agoI'm honestly not surprised that SQLite handles this situation (I seriously doubt there's any file-system oddity I've run into that Hipp hasn't). But just being "append only" is insufficient.