Commit Graph

574 Commits

Author SHA1 Message Date
Pere Diaz Bou
cf62099bf5 allow insertion of multiple overflow cells 2025-04-08 16:43:15 +02:00
Pere Diaz Bou
029da5c81c Improve readability of balance_non_root with comments and validation extraction 2025-04-08 16:43:15 +02:00
Pere Diaz Bou
fded6ccaf3 rever iterations fuzz test 2025-04-08 14:09:17 +02:00
Pere Diaz Bou
c0c66bf8af remove wrong comment 2025-04-08 14:06:48 +02:00
Pere Diaz Bou
8c4003908f bring back usize, it shouldn't underflow 2025-04-08 14:05:30 +02:00
Pere Diaz Bou
40f8bbe132 clippy 2025-04-08 11:31:38 +02:00
Pere Diaz Bou
8e88b0cd14 new_page_sizes as Vec<i64> 2025-04-08 11:31:38 +02:00
Pere Diaz Bou
3950ab1e52 account for divider cell size in page size 2025-04-08 11:31:38 +02:00
Pere Diaz Bou
6086284613 fix debug imports 2025-04-07 18:06:52 +02:00
Pere Diaz Bou
83f13596a4 decrease fuzz test steps again 2025-04-07 18:01:08 +02:00
Pere Diaz Bou
f137ddfdf8 add loop left pointer validation 2025-04-07 18:01:08 +02:00
Pere Diaz Bou
6ac2368ae2 update divider cell that is being balanced 2025-04-07 18:00:49 +02:00
Pere Diaz Bou
0541da46df add strict btree validation after non root balancing in debug mode 2025-04-07 18:00:49 +02:00
Pere Diaz Bou
ff8ec5455c fix divider cell selection 2025-04-07 18:00:30 +02:00
Pere Diaz Bou
9eb9e7021e Fix index table new divider cell pointer 2025-04-07 18:00:30 +02:00
Pere Diaz Bou
f4920cb96b assert new divider cell points to the correct place 2025-04-07 18:00:30 +02:00
Pere Diaz Bou
15ed7642c9 check all keys are present on every insert with fuzz test
Let's make sure every insert does still contain all keys. Previously we
did this at the end but it made it hard to debug issues that
`validate_btree` might not encounter.
2025-04-07 18:00:30 +02:00
PThorpe92
bd04b10f17 Fix btree tests to adapt to new type for BTreeKey 2025-04-05 11:19:10 -04:00
PThorpe92
abc97c8774 Add doc comments to new btree key enum and remove unused lifetimes 2025-04-05 11:19:10 -04:00
PThorpe92
6b42808f1a Dont re-seek if we are inserting a new unique index 2025-04-05 11:19:10 -04:00
PThorpe92
068ab4ab27 Refactor btree to reuse existing insert and seek with idx keys 2025-04-05 11:19:09 -04:00
PThorpe92
007fbe8cc7 Fix unique index issue and prealloc in sql string for schema 2025-04-05 11:19:09 -04:00
PThorpe92
2c3fd509fe Remove unused imports and consolidate ordering comparison 2025-04-05 11:19:09 -04:00
PThorpe92
b0016a0ee2 Support create index with SeekEnd and IdxCreate opcode functionality 2025-04-05 11:15:36 -04:00
Pere Diaz Bou
5dedc68fda remove arc import 2025-04-02 16:56:34 +02:00
Pere Diaz Bou
e85fb86ff4 Request load page on insert_into_page
We assumed page was loaded because before inserting we would move there. `NewRowId` unfortunately moves cursor to the rightmost page causing eviction of root page -- this arose the issue with `insert_into_page` not loading the page we were supposed to have loaded so I added `return_if_locked_maybe_load` which is a utility macro to check if the page is locked and if not, load it if needed.
2025-04-02 16:24:53 +02:00
Pekka Enberg
7394ad6854 Disable more b-tree fuzzers... 2025-04-02 13:38:09 +03:00
Pekka Enberg
cc8340d30e Disable btree_insert_fuzz_run_random test 2025-04-02 09:15:01 +03:00
Pekka Enberg
6199c3994a Merge 'Create plan for Update queries' from Preston Thorpe
closes #1186, or at least works towards it by implementing an actual
Plan for update queries instead of translating everything inline. This
allows for actually using index's, rewriting const expressions, pushing
predicates instead of hardcoding a full scan in the translation.
### TODOs:
1.  `RETURNING` clause/result columns
2.  `OFFSET` clauses
3. on conflict
### LIMIT:
By supporting `LIMIT` directly in update queries, we'll have to put the
tests outside of the compatibility tests, maybe in the CLI tests.

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #1189
2025-04-01 17:33:32 +03:00
Pere Diaz Bou
6b05dbddb0 remove unnecessary code while building count old and size old balancing 2025-04-01 13:11:55 +02:00
Pere Diaz Bou
141303e330 Validate cells inside a page after each operation
We need to ensure an operation doesn't transform the cells inside a page
to an invalid state. In debug mode we can enable a
`debug_validate_cells` with `#[cfg(debug_assertions)]` so that it is
skipped on release mode.

Modify pager logs
2025-04-01 11:19:23 +02:00
Pere Diaz Bou
bab748e538 fix key generation 2025-04-01 01:05:07 +02:00
Pere Diaz Bou
d2642dfe0c skip repeated keys 2025-04-01 00:58:10 +02:00
Pere Diaz Bou
4308f8c73a Fix propagation of divider cell balancing interior page
Newly added divider cells to parent of an interior page must point to
the page in question. Moreover rightmost pointer of the page will point
to previous divider cell pointer.
2025-04-01 00:58:10 +02:00
Pere Diaz Bou
24e4af7ee8 Allow balance_root to balance with interior pages 2025-03-31 12:42:01 +02:00
Pere Diaz Bou
78f6480e8f remove ignored from fuzz tests 2025-03-31 10:59:28 +02:00
Pere Diaz Bou
bc660446a8 fuzz test ensure we "seek" until done 2025-03-31 10:57:55 +02:00
Pere Diaz Bou
0653ccf711 ensure btree fuzz doesn't repeat keys for now 2025-03-31 10:57:30 +02:00
PThorpe92
516e443a2b Fix use index cursor id in emitter and prevent reinsert pk on update 2025-03-30 12:15:25 -04:00
Pere Diaz Bou
541b67bd2b rename get_lazy_immutable_record -> get_immutable_record_or_create 2025-03-30 11:00:59 +02:00
Pere Diaz Bou
6ccb2e16d1 safer api for ImmutableRecord recreation 2025-03-30 11:00:13 +02:00
Pere Diaz Bou
d9f5cd870d clippy 2025-03-29 22:04:08 +01:00
Pere Diaz Bou
e504262bd5 fix rebase 2025-03-29 22:04:08 +01:00
Pere Diaz Bou
3317195a53 Reusable ImmutableRecord -> allocation reduction
Improve allocation usage from ImmutableRecords by reusing them.
ImmutableRecord is basically a contigous piece of memory that holds the
current record. If we move to some other record we usually deallocate
the previous one and allocate a new one -- obviously this is wasteful.
With this commit we will reuse the ImmutableRecord to allow payload to
be extended if needed or reused if we can, making it faster to iterate
records basically.
2025-03-29 22:04:08 +01:00
Pere Diaz Bou
5b7fcd27bd make column reuse blob/text fields 2025-03-29 22:02:49 +01:00
Pere Diaz Bou
bf37fd3314 wip 2025-03-29 22:02:49 +01:00
Pere Diaz Bou
c5b718ac32 fix review comments 2025-03-28 11:30:19 +01:00
Pere Diaz Bou
83d0c9a1b6 fix read overflow page procedure 2025-03-28 11:30:19 +01:00
Pere Diaz Bou
f51c20adf0 read overflow pages on demand 2025-03-28 11:12:43 +01:00
Pere Diaz Bou
dc8acf1a4a cell_get no allocations 2025-03-28 11:12:27 +01:00