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
Nikita Sivukhin
eec0493c60
remove misleading comment
2025-02-09 17:31:39 +04:00
Nikita Sivukhin
fc502b86c7
fix defragmentation code a bit
2025-02-09 17:31:39 +04:00
Nikita Sivukhin
5ce3d12f75
fix typo
2025-02-09 17:31:39 +04:00
Nikita Sivukhin
3557c8aada
adjust fuzz test
2025-02-09 17:31:39 +04:00
PThorpe92
75898027a0
Remove unnecessary reference counting from completion io callbacks
2025-02-08 08:20:19 -05:00
Nikita Sivukhin
75e2f01ec4
print btree for debugging
2025-02-08 13:03:38 +04:00
Nikita Sivukhin
55dd108878
setup simple insertion fuzz test
2025-02-08 12:38:32 +04:00
Krishna Vishal
7cb7eb4e65
Merge branch 'main' into delete-btree-row
2025-02-07 01:15:21 +05:30
krishvishal
349fd51559
Get db_header from Pager instead of BTreeCursor.
...
Fix page_cache in btree tests to use `parking_lot::RwLock`
2025-02-07 00:11:06 +05:30
krishvishal
f836ad7561
Remove write to PAGE_HEADER_OFFSET_CELL_CONTENT_AREA in insert_into_cell. This causes corruption when you reuse cell spaces from free_list.
2025-02-06 23:39:12 +05:30
krishvishal
7d67895306
1. Added frangmentation handling to find_free_cell
...
2. Added asserts and corruption error to `allocate_cell_space`
2025-02-06 23:39:09 +05:30
krishvishal
8263bd0482
Update page offsets in drop_cell and update cell pointer array after dropping a cell.
2025-02-06 23:36:27 +05:30
krishvishal
73dae3003d
Implement block coalescing in free_cell_range to reduce fragmentation and also added fragmentation tracking.
2025-02-06 23:36:26 +05:30
krishvishal
95da2244bb
Implemented delete(). Now we are able to delete a row. It handles both interior page and leaf page cell differently.
2025-02-06 23:34:27 +05:30
krishvishal
f62ec61694
Added a unit-test to test the case where clear_overflow_pages function is called on cell with no overflow pages
2025-02-06 23:34:26 +05:30
krishvishal
8c763780a8
Added free list and free_page functionality in Pager module. Now we can add dropped pages to free list, so pages can be reused in allocate_page.
2025-02-06 23:34:12 +05:30
krishvishal
83b214a4e3
Added clear_over_pages it deletes all the overflow pages related to a cell.
2025-02-06 23:27:07 +05:30
Pekka Enberg
f3902ef9b6
core: Rename OwnedRecord to Record
...
We only have one record type so let's call it `Record`.
2025-02-06 13:40:34 +02:00
Alex Miller
9ac52b66d9
Refactor cursor to support multiple state machines
2025-01-30 14:08:44 -08:00
Pekka Enberg
983875c443
core: Remove database header from BTreeCursor
...
It's already in the pager so use it from there to reduce the size of the
`BTreeCursor` struct.
2025-01-26 16:48:12 +02:00
Jorge López
218a2e6dda
syntactic changes: remove unneeded mut, lifetimes,references that get instantaneously dereferenced and casts
2025-01-18 18:43:47 +01:00
Jorge López
2cc8cb9ad8
syntactic changes: use assert_eq!() instead of assert!() for equality comparisons
2025-01-18 18:37:50 +01:00
Jorge López
f160206cdd
syntactic changes: replace unwrap() with ? in functions that return Result<...>
2025-01-18 18:33:43 +01:00
Jorge López
86a4714711
syntactic changes: remove unneeded paths when the type is already imported
2025-01-18 18:29:12 +01:00
Jussi Saurio
bf48c0ae72
Remove trait Cursor
2025-01-11 17:19:25 +02:00
Pere Diaz Bou
6802bb7e6a
distinguish balance and balance_non_root
...
`balance_non_root` should be as close as possible to `balance_non_root`
in SQLite. This commits extract `balance_non_root` from `balance` and
renames `balance_leaf` to `balance` as it enables future work on a
complete `balance_non_root` procedure.
2025-01-08 19:05:49 +01:00
Kould
a33984087f
chore: add comment on BTreeCursor::seek
2025-01-02 18:18:17 +08:00
Kould
e5d0ad044e
fix: index seek wrong
2025-01-02 11:11:44 +08:00
Lauri Virtanen
854005b977
Run cargo clippy --fix && cargo fmt
2024-12-29 19:22:28 +02:00
김선우
ad2d515ffd
Merge branch 'main' into feature/delete-planning
2024-12-27 23:21:35 +09:00
Pekka Enberg
5065074617
Merge 'core: disk serialization changes to align with sqlite' from Jussi Saurio
...
This PR's genesis is from investigating #532 , but I still can't reliably
reproduce it on either `main` or this branch so I don't know if this PR
_fixes_ anything, but I guess it aligns us more with sqlite anyway
---
Anyway: I looked at DBs created with limbo and with sqlite using
[ImHex](https://github.com/WerWolv/ImHex ) and the differences seem to
be:
1. SQLite uses varint according to [the
spec](https://www.sqlite.org/fileformat.html#record_format ), whereas
limbo always encodes integers as i64
2. Limbo adds 4 bytes of zeros for overflow page pointer (even in cases
where the cell doesnt overflow)
3. Limbo adds a space after `CREATE TABLE name` before the `(` even when
user doesn't specify it?
I implemented the following:
- Fix 1: Varint serialization of i8, i16, i24, i32, i48 and i64
according to payload, instead of always using i64
- Fix 2: Removed the 4 bytes reserved for overflow page pointer in non-
overflow cases
Reviewed-by: Pere Diaz Bou <pere-altea@homail.com >
Closes #550
2024-12-27 10:06:52 +02:00
jussisaurio
80933a32e9
remove space allocated for overflow pointer in non-overflow cases
2024-12-25 23:09:23 +02:00
jussisaurio
42ea9041e1
rename cell_get_raw_pointer_region() and refactor a bit
2024-12-24 19:27:01 +02:00
jussisaurio
25338b5cb4
refactor compute_free_space()
2024-12-24 19:00:22 +02:00
jussisaurio
c6b7ddf77a
Improve comments in BTreeCursor::compute_free_space()
2024-12-24 10:30:27 +02:00
jussisaurio
91cca0d5b7
use more descriptive names in BTreeCursor::insert_into_cell()
2024-12-24 10:28:53 +02:00
jussisaurio
9ea4c95ee1
even more comments
2024-12-23 22:07:20 +02:00
jussisaurio
6a287ae1a9
add comment about cell_content_area 0 value meaning u16::MAX
2024-12-23 21:33:57 +02:00
jussisaurio
40a0bef0dc
better fixme comments
2024-12-23 21:19:18 +02:00
jussisaurio
c417fe7880
add link to sqlite source about payload_overflows()
2024-12-23 21:14:20 +02:00
jussisaurio
b57a95752c
core/btree: improve documentation
2024-12-22 23:05:25 +02:00
김선우
9bacf80f2e
Change to println!
2024-12-22 14:41:12 +09:00