mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-27 13:04:20 +01:00
Another fix extracted from running simulations on the #1988 branch. When interior cell replacement happens as described in #2108, we use the `cursor.prev()` method to locate the largest key in the left subtree. There was an error during backwards traversal in the `get_prev_record()` method where the parent's cell index was set as `i32::MAX` but not properly set to `cell_count + 1` (indicating that rightmost pointer has been visited). The reason `i32::MAX` is used is that the cell count of the page is not necessarily known at the time it is pushed to the stack. This PR fixes the issue by setting the cell index of the parent properly when visiting the rightmost child.