mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-28 21:44:21 +01:00
This PR introduce simple fuzz test for BTree insertion algorithm and fixes few bugs found by fuzzer - BTree algorithm returned early although there were overflow pages on stack and more rebalances were needed - BTree balancing algorithm worked under assumption that single page will be enough for rebalance - although this is not always true (if page were tightly packed with relatively big cells, insertion of new very big cell can require 3 split pages to distribute the content between them) - `overflow_cells` wasn't cleared properly during rebalancing - insertions of dividers to the parent node were implemented incorrectly - `defragment_page` didn't reset `PAGE_HEADER_OFFSET_FRAGMENTED_BYTES_COUNT` field which can lead to suboptimal usage of pages Closes #951