mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-29 04:44:23 +01:00
This patch adds checksums to Turso DB. You may check the design here in the [RFC](https://github.com/tursodatabase/turso/issues/2178). 1. We use reserved bytes (8 bytes) to store the checksums. On every IO read, we verify that the checksum matches. 2. We use twox hash for checksums. 3. Checksum works only on 4K pages now. It's a small change to enable for all other sizes, I will send another PR. 4. Right now, it's not possible to switch to different algorithm or turn off altogether. That will be added in the future PRs. 5. Checksums can be enabled only for new dbs. For existing DBs, we will disable it. 6. To add checksums for existing DBs, we need vacuum since it would require rewrite of whole db. Closes #2840