Commit Graph

247 Commits

Author SHA1 Message Date
Pere Diaz Bou
b64cc769b6 fix rebase 2025-02-16 18:31:03 +01:00
Pere Diaz Bou
b5ec5186ea fix divider cell on leaf data 2025-02-16 18:30:42 +01:00
Pere Diaz Bou
177dbcd403 simplify balance_root 2025-02-16 18:01:33 +01:00
Pere Diaz Bou
f9d979575b fix defragment_page cell payload size calculation 2025-02-15 16:51:52 +01:00
Pere Diaz Bou
d3574f1e55 fix root offfset handling 2025-02-15 16:51:52 +01:00
Pere Diaz Bou
8ba7022e0b remove dbg prints 2025-02-15 16:51:52 +01:00
Pere Diaz Bou
1b96bd8a30 fix free_cell_area offset check 2025-02-15 16:46:22 +01:00
Pere Diaz Bou
7e55f46b26 fix defragment 2025-02-15 16:46:22 +01:00
Pere Diaz Bou
c65dce6cfd re implemenet free cell range 2025-02-15 16:46:22 +01:00
Pere Diaz Bou
9d2aaea439 add no offset write and read u16 from page 2025-02-15 16:46:22 +01:00
Pere Diaz Bou
4907de6e21 fix rightpoitner load + some stuff 2025-02-15 16:46:22 +01:00
Pere Diaz Bou
5ff66b8c62 fix reset content area in drop_cell 2025-02-15 16:42:26 +01:00
Pere Diaz Bou
78e7364f45 fuzz test 2025-02-15 16:30:59 +01:00
Pere Diaz Bou
ea77902e24 add defragment test after deletion of odd cells
Signed-off-by: Pere Diaz Bou <pere-altea@hotmail.com>
2025-02-15 16:30:59 +01:00
Pere Diaz Bou
0274f74f32 fix drop cell and add some tests 2025-02-15 16:30:59 +01:00
Pere Diaz Bou
44857cdd17 fix insert test 2025-02-15 16:21:33 +01:00
Pere Diaz Bou
48f0fe0904 multiple cell insert test 2025-02-15 16:21:33 +01:00
Pere Diaz Bou
c4c5a74e16 add a bit of testing 2025-02-15 16:21:33 +01:00
Pere Diaz Bou
7e3470fb8e fix rebase 2025-02-15 16:18:04 +01:00
Pere Diaz Bou
915bb42412 fix rightmost pointer update 2025-02-15 16:18:04 +01:00
Pere Diaz Bou
0c015e43a2 some fixes 2025-02-15 16:18:04 +01:00
Pere Diaz Bou
05ca716f82 up to finish without fixing stuff 2025-02-15 16:11:29 +01:00
Pere Diaz Bou
0035b9d1bd up to edit 2025-02-15 15:55:42 +01:00
Pere Diaz Bou
1266994a0a balance sibling pages 2025-02-15 15:37:13 +01:00
Doug Anderson444
0aa5de6d9f rm log, switch all to tracing 2025-02-11 09:03:36 -04:00
Pekka Enberg
d221f158cc Merge 'Add read implementation of user_version pragma with ReadCookie opcode' from Jonathan Webb
Just a bare bones implementation of ReadCookie and support for the
user_version pragma

Closes #909
2025-02-10 12:12:15 +02:00
Pekka Enberg
0638550be7 Merge 'Remove unnecessary reference counting from completion I/O callbacks' from Preston Thorpe
I am on a bit of a mission to revisit a lot of the ref counting, this
was an easy first win.
It seems to be a linear path of function calls or hashmaps which can own
the completions directly, no cloning needed.

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

Closes #912
2025-02-10 12:11:30 +02:00
Pekka Enberg
604ca4085d Merge 'Make record values private' from Tiago
This is an attempt to move towards #881. I am not sure this is the
direction you want to take. In any case, I thought I would take a crack
at converting `values` from `Record` to private and see how bad it would
be.
In the end, as you can see, it is not so bad. I think performance-wise
it shouldn't be a bad hit with Rust's zero-cost abstraction. Also,
during the process I noticed a couple improvements that could be made
here and there but I honestly wanted to start with something small
enough that wouldn't be too hard to review.
Anyway, let me know if this is really how you would like to proceed.

Closes #962
2025-02-10 11:23:21 +02:00
Pekka Enberg
fcad8d125e Merge 'refactor: remove RC<String> requirement for build_text and new text' from Pedro Muniz
This PR aims to simplify text creation and to reduce allocation overhead
of creating a new OwnedValue::Text. Instead of creating Rc<String> every
time you need to create a text, you just pass the string slice and the
Rc<String> is created at the end. This change, at least on my machine,
has removed a lot of variability in the benchmarking performance, while
maintaining roughly the same performance.

Closes #961
2025-02-10 11:21:50 +02:00
Tiago Ribeiro
af12036e88 Update core/storage/btree.rs to use the new retrieval methods to access Record values. 2025-02-10 00:27:51 -07:00
Pekka Enberg
bad5f2cad3 Merge 'Fix a handful of typos' from Aarni Koskela
I noticed the README had a prominent typo ("workin on"), so I decided to
run [crate-ci/typos](https://github.com/crate-ci/typos) on the repo and
fix what it flagged.

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

Closes #952
2025-02-10 07:41:01 +02:00
Pekka Enberg
2eda8a54d9 Merge 'Fix various bugs in B-Tree handling' from Nikita Sivukhin
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
2025-02-10 07:40:27 +02:00
pedrocarlo
fe453ecfc5 remove RC<String> requirement for build_text and new text 2025-02-09 13:44:39 -03:00
Aarni Koskela
eaea02c567 Fix a handful of typos 2025-02-09 18:08:29 +02:00
Nikita Sivukhin
1b9772e9ad fix clippy 2025-02-09 19:36:14 +04:00
Nikita Sivukhin
32b5b0d019 introduce additional condition for cells distribution in order to avoid almost empty pages 2025-02-09 19:26:03 +04:00
Nikita Sivukhin
bc289d314a adjust test a bit 2025-02-09 19:20:48 +04:00
Nikita Sivukhin
e23ea35993 add simple B-tree validation func 2025-02-09 19:20:37 +04:00
Nikita Sivukhin
a59589844d fix insertion to the parent 2025-02-09 19:19:36 +04:00
Nikita Sivukhin
6c40f52fc8 separate fuzz tests in categories 2025-02-09 18:37:04 +04:00
Nikita Sivukhin
9049c91863 find cell in parent node 2025-02-09 18:36:37 +04:00
Nikita Sivukhin
9e4afd1d13 relax assertion 2025-02-09 18:36:26 +04:00
Nikita Sivukhin
8e6569434a add fuzz 2025-02-09 18:10:59 +04:00
Nikita Sivukhin
a62265eef4 hanle balancing cases when more than 1 level is affected 2025-02-09 18:10:19 +04:00
Nikita Sivukhin
d2251b1dd1 fix 2025-02-09 18:09:53 +04:00
Nikita Sivukhin
e8a585f87a adjust logging 2025-02-09 18:09:43 +04:00
Nikita Sivukhin
8659dbba8e fix pointer structure in case of root split 2025-02-09 17:31:39 +04:00
Nikita Sivukhin
d4bbad161b handle case when we can't balance all cells between current page and one new allocated page
- if we have page which is tightly packed with relatively big cells, we
  will be unable to balance its content if we will insert very big
  (~page size) cell in the middle (because nothing can't be merged with
  new cell - so we will need to split 1 page into 3)
2025-02-09 17:31:39 +04:00
Nikita Sivukhin
ea61f31843 clear overflow_cells 2025-02-09 17:31:39 +04:00
Nikita Sivukhin
6aa10701a4 fix comment 2025-02-09 17:31:39 +04:00