mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-02 16:04:20 +01:00
Sqlite has a crazy easter egg where a 1 Gib file offset, it creates a `PENDING_BYTE_PAGE` that is used only by the VFS layer, and is never read or written into. To properly test this, I took inspiration from SQLITE testing framework, and defined a helper method, that is conditionally compiled with the `test_helper` feature enabled. https://github.com/sqlite/sqlite/blob/7e38287da43ea3b661da3d8c1f431aa907 d648c9/src/main.c#L4327 As the `PENDING_BYTE` is normally at the 1 Gib mark, I created a function that modifies the static `PENDING_BYTE` atomic to whatever value we want. This means we can test this unusual behaviours at any DB file size we want. `fuzz_pending_byte_database` is the test that fuzzes different pending byte offsets and does an integrity check at the end to confirm, we are compatible with SQLITE Closes #2749 <img width="1100" height="740" alt="image" src="https://github.com/user- attachments/assets/06eb258f-b4b4-47bf-85f9-df1cf411e1df" /> Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com> Closes #3431