Nikita Sivukhin
6e2ccdff20
add btree fuzz tests which generate seed file from scratch
2025-07-14 13:01:15 +04:00
Nikita Sivukhin
fc400906d5
handle case when target seek page has no matching entries
2025-07-14 13:01:15 +04:00
Nikita Sivukhin
03b2725cc7
return SeekResult from seek operation
...
- Apart from regular states Found/NotFound seek result has TryAdvance
value which tells caller to advance the cursor in necessary direction
because the leaf page which would hold the entry if it was present
actually has no matching entry (but neighbouring page can have match)
2025-07-14 13:01:15 +04:00
Krishna Vishal
ea4a4708ea
- Address some review comments
...
- Add docs for `RecordCursor`
2025-07-14 03:28:55 +05:30
Krishna Vishal
b1f27cad94
chore: fix clippy
2025-07-14 03:28:55 +05:30
Krishna Vishal
d3368a28bc
fix merge conflicts
2025-07-14 03:28:55 +05:30
Krishna Vishal
e7e5f28c0a
chore: Clippy chill
2025-07-14 03:28:54 +05:30
Krishna Vishal
35ed279644
Clean up indexbtree_move_to
2025-07-14 03:28:54 +05:30
Krishna Vishal
f0e8e5871b
Replace compare_immutable with compare_records_generic
2025-07-14 03:28:54 +05:30
Krishna Vishal
860de412d9
Add num_columns to BTreeCursor so we can initialize
...
`Vecs` inside `RecordCursor` to their appropriate to reduce
allocations.
2025-07-14 03:28:54 +05:30
Krishna Vishal
ef147181c2
Working version of the incremental column and "optimal" record
...
compare functions. Now we optimize them
2025-07-14 03:28:54 +05:30
Krishna Vishal
692f0413eb
Stash
2025-07-14 03:28:54 +05:30
Krishna Vishal
c7aa3c3d93
Fix btree to invalidate RecordCursor
...
Use `read_value` instead of `deserialize_column_data`
Add `sqlite_int_float_compare` which takes care of out of range
floats
2025-07-14 03:28:54 +05:30
Krishna Vishal
2323763a4f
Integrate incremental column parsing into btree.rs
2025-07-14 03:28:54 +05:30
Jussi Saurio
a48b6d049a
Another post-rebase clippy round with 1.88.0
2025-07-12 19:10:56 +03:00
Nils Koch
1a91966c7e
fix clippy errors for rust 1.88.0 (manual fix)
2025-07-12 18:58:55 +03:00
Nils Koch
828d4f5016
fix clippy errors for rust 1.88.0 (auto fix)
2025-07-12 18:58:41 +03:00
Jussi Saurio
0009683566
Merge 'btree/balance/validation: fix divider cell insert validation' from Jussi Saurio
...
Closes #2047
the validation code was assuming that:
- if the parent has overflow cells after inserting a divider cell
- the exact divider we are validating MUST be in those overflow cells
However, this is not necessarily the case. Imagine:
- First divider gets inserted at index `n`. It is too large to fit, so
it gets pushed to `parent.overflow_cells()`. Parent usable space does
not decrease.
- Second divider gets inserted at index `n+1`. It is smaller, so it
still fits in usable space.
Hence:
Provide information to the validation function about whether the
inserted cell overflowed, and use that to find the left pointer and
assert accordingly.
Reviewed-by: Pere Diaz Bou <pere-altea@homail.com >
Closes #2050
2025-07-11 15:09:19 +03:00
Pekka Enberg
7b646da82c
Merge 'Btree: more balance docs' from Jussi Saurio
...
Continuation from #2031 -- some variable extractions and comments
Reviewed-by: Pere Diaz Bou <pere-altea@homail.com >
Closes #2035
2025-07-11 15:06:45 +03:00
Jussi Saurio
c81522c20f
btree/balance/validation: fix divider cell insert validation
...
the validation code was assuming that:
- if the parent has overflow cells after a inserting divider cell
- the exact divider we are validating MUST be in those overflow cells
However, this is not necessarily the case. Imagine:
- First divider gets inserted at index `n`. It is too large to fit,
so it gets pushed to `parent.overflow_cells()`. Parent usable space
does not decrease.
- Second divider gets inserted at index `n+1`. It is smaller, so it
still fits in usable space.
Hence:
Provide information to the validation function about whether the inserted
cell overflowed, and use that to find the left pointer and assert accordingly.
2025-07-11 11:21:05 +03:00
Jussi Saurio
99df69f603
btree/balance/validation: fix use-after-free of rightmost ptr validation
...
We can use `right_page_id` directly to perform the validation instead of
carrying a raw pointer around which might be invalidated by the time we
do the validation.
2025-07-10 18:23:54 +03:00
Jussi Saurio
a403e55319
btree: add comment about when left-to-right size balancing is stopped
2025-07-10 15:52:18 +03:00
Jussi Saurio
bc328f9738
btree: one more is_last_sibling doc variable
2025-07-10 15:39:22 +03:00
Jussi Saurio
fc27c08e11
clippy
2025-07-10 15:36:46 +03:00
Jussi Saurio
fba05b1998
btree: add named range variables to make cell movement double-pass clearer
2025-07-10 15:34:41 +03:00
Jussi Saurio
8f1109692f
btree: replace a bunch of 'count-1' conditions with is_last_sibling variables
2025-07-10 15:31:53 +03:00
Jussi Saurio
a81d81685f
btree: rename divider_cells to divider_cell_payloads for clarity
2025-07-10 15:29:01 +03:00
Jussi Saurio
5d0b410e70
btree: rename constant to mention siblings
2025-07-10 15:28:11 +03:00
Jussi Saurio
78a249c6d0
btree: add MAX_SIBLING_PAGES_TO_BALANCE constant and use it
2025-07-10 15:27:37 +03:00
Jussi Saurio
6ff13113ce
btree: add MAX_NEW_PAGES_AFTER_BALANCE constant and use it
2025-07-10 15:24:32 +03:00
Jussi Saurio
10d301c53c
btree: use size-related new constants instead of literal numbers
2025-07-10 15:21:00 +03:00
Jussi Saurio
0b8c5f7c91
btree/balance: extra doc context for CellArray::cell_payloads
2025-07-10 15:06:27 +03:00
Jussi Saurio
475bced4f7
btree/balance: remove obsolete todo
2025-07-10 14:58:00 +03:00
Jussi Saurio
0316b5a517
btree/balance: rename CellArray::cell_data to cell_payloads
2025-07-10 14:57:45 +03:00
Jussi Saurio
0d973d78a9
btree/balance: add a diagram about divider cell assignment and some comments
2025-07-10 14:56:59 +03:00
Jussi Saurio
610b743f0d
btree/balance: rename CellArray::cell_count to CellArray::cell_count_up_to_page
2025-07-10 13:51:56 +03:00
Jussi Saurio
924482981c
btree/balance: rename CellArray::cell_size to CellArray::cell_size_bytes
2025-07-10 13:50:14 +03:00
Jussi Saurio
68cd948056
btree/balance: add extra documentation for page update dual pass
2025-07-10 13:47:08 +03:00
Jussi Saurio
3fc51ed4d9
btree/balance: rename leaf to is_leaf
2025-07-10 13:16:14 +03:00
Jussi Saurio
d88bbd488f
btree/balance: rename leaf_data to is_table_leaf
2025-07-10 13:15:29 +03:00
Jussi Saurio
b306550a69
format
2025-07-10 13:14:57 +03:00
Jussi Saurio
5ef0127409
btree/balance: rename count_cells_in_old_pages to old_cell_count_per_page_cumulative
2025-07-10 13:14:18 +03:00
Jussi Saurio
c31ee0e628
btree/balance: rename number_of_cells_per_page to cell_count_per_page_cumulative
2025-07-10 13:12:17 +03:00
Jussi Saurio
824065a91d
btree/balance: rename cells to cell_data
2025-07-10 13:10:31 +03:00
Jussi Saurio
37f2317e49
btree/balance: add comment about divider cell
2025-07-10 13:09:29 +03:00
Jussi Saurio
4d691af3ee
btree/balance: clearer variable name
2025-07-10 13:08:58 +03:00
Jussi Saurio
e51f0f5466
btree/balance: improve comment
2025-07-10 13:08:35 +03:00
Jussi Saurio
201edf3668
btree/balance: add comment
2025-07-10 13:05:54 +03:00
Jussi Saurio
fd0a47dc6b
btree: simplify pattern match
2025-07-10 13:05:15 +03:00
Jussi Saurio
4dc3e2100f
btree: rename balance_non_root related enum variants and add docs
2025-07-10 13:02:50 +03:00