Commit Graph

614 Commits

Author SHA1 Message Date
jussisaurio
6dc427fc9b Merge 'impl order by desc' from lemonwx
Hi all,
I attempted to implement the `order by desc`, which mainly consists of
the following two parts:
1. for cases where the primary key can be utilized, I implemented
`push_scan_direction` to push the scan direction down to the `Scan`.
2. for cases where the primary key cannot be utilized, I re-implemented
the sorting in `Sorter::rewind` based on whether it's desc or asc.
there is also some related work to be done, such as sort using secondary
index, I will attempt to do next.
Please help review this and let me know how I can improve it, thanks in
advance

Reviewed-by: Pere Diaz Bou <pere-altea@hotmail.com>

Closes #376
2024-11-21 16:37:38 +02:00
Pekka Enberg
de40442677 core: Remove unused import from btree.rs 2024-11-20 11:55:49 +02:00
Pere Diaz Bou
51ad827f1f fmt 2024-11-19 17:56:24 +01:00
Pere Diaz Bou
f5a1f7c800 various fixes in btree
* read_u8 now takes self.offset into account
* shift cell pointers left on balance_root with offset > 0
* fix wrong writes to page in degragment_page
2024-11-19 17:15:19 +01:00
limeng.1
a188bcd287 fix 2024-11-19 16:45:17 +08:00
limeng.1
5e9e701417 resolve comments 2024-11-19 11:39:08 +08:00
limeng.1
c51750fad5 fix lint 2024-11-19 11:39:08 +08:00
limeng.1
1cb1d16c08 resolve comments 2024-11-19 11:39:08 +08:00
limeng.1
8cca659052 impl order by desc 2024-11-19 11:39:07 +08:00
Pere Diaz Bou
db343ac5ea fix page1 balancing 2024-11-18 16:25:06 +01:00
Pere Diaz Bou
4aa5612334 fix schema query 2024-11-18 14:06:50 +01:00
Pere Diaz Bou
9f72655e30 tree_create -> btree_create 2024-11-18 10:31:47 +01:00
Pere Diaz Bou
090615b289 create btree table + parse schema 2024-11-16 16:24:28 +01:00
Pere Diaz Bou
66e20df309 fix some offset usages in btree 2024-11-16 16:23:06 +01:00
Pere Diaz Bou
6cd0f03643 core: create databases from limbo 2024-11-15 12:09:07 +01:00
Pere Diaz Bou
c46bd63b5a core: drop mutex on contents
There is no need to have mutexes on buffers, we will introduce mutexes
if we want later on a file level to introduce serializability.
2024-11-13 19:13:15 +01:00
Pere Diaz Bou
2a787aedb5 core: extract page stack and document a bit 2024-11-13 17:13:30 +01:00
Pere Diaz Bou
78118bae81 fmt 2024-11-13 09:34:36 +00:00
Pere Diaz Bou
eb4105282b btree: fix btree traversal 2024-11-12 23:10:38 +00:00
Pere Diaz Bou
807496a146 core: load pages if not loaded
Since pages are now tracked with a single centralized structure, it is
possible for a page to have been unloaded a be kept in memory for
metadata purposes like going back in the stack.

Using the example of going to a parent page which was unloaded for
whatever reason: in this case we need to check if it's loaded, if not,
we load it. Locked still means the same thing, loaded just means the
contents of a page are present in memory and if they are present, they
must be in cache.
2024-11-12 14:44:25 +01:00
Pere Diaz Bou
cd2b61d838 btree: cursor with lineal stack structure
Removed MemPage from the code in favor of an array to encode the stack
of the cursor. This is both simpler and better in terms of memory
access.
2024-11-12 10:21:22 +01:00
Pere Diaz Bou
ce8378793e btree: run until finished or IO + bug fixes 2024-11-11 17:03:15 +01:00
Pere Diaz Bou
74974d07e7 clippy fix 2024-11-08 11:14:29 +01:00
Pere Diaz Bou
e5836df160 write state machine
Returning on ongoing IO requires to save the current state, therefore a
state machine makes sense for write operations. This information is
encoded in WriteInfo/WriteState.
2024-11-08 11:10:49 +01:00
Pere Diaz Bou
ecfcd8835f rename get_page -> get_current_page 2024-11-07 15:37:21 +01:00
jussisaurio
f634e7f7a3 clippy fix 2024-10-13 12:08:54 +03:00
jussisaurio
556f4b73c9 Refine edge case handling: add optional predicate to get_next_record() 2024-10-08 08:23:30 +03:00
jussisaurio
43038cb6aa Handle seek() edge case with index seek 2024-10-08 07:45:21 +03:00
jussisaurio
572db69b5e Add TODO comment about index corner case 2024-10-07 17:12:19 +03:00
jussisaurio
93a8110773 dont assume index key has rowid in the second column: its the last 2024-10-07 17:05:38 +03:00
jussisaurio
8563d620af renaming 2024-10-07 17:03:50 +03:00
jussisaurio
fc71f2b32f traverse index properly
interior index cells have values that are not in the leaves, e.g.

     (interior: 3)
    /            \
(leaf: 2)     (leaf: 4)

so their values need to be emitted after the left subtree is emitted.
2024-10-07 13:04:03 +03:00
jussisaurio
e5cf052f07 Why do sqlite btree child keys have <= keys and not < keys 2024-10-06 23:48:59 +03:00
jussisaurio
15a66ea662 single seek function in cursor trait 2024-10-06 09:21:15 +03:00
jussisaurio
6e7db36121 reorder 2024-10-06 00:58:32 +03:00
jussisaurio
af9a751d36 Single seek function 2024-10-06 00:56:18 +03:00
jussisaurio
1ae8d28669 Use same move_to() function for tables and indexes 2024-10-06 00:51:14 +03:00
jussisaurio
37f877109e Reduce duplication in btree.rs 2024-10-06 00:39:50 +03:00
jussisaurio
3826d4e1ff Add comment about code duplication 2024-10-05 18:25:04 +03:00
jussisaurio
d2233d69d3 Dont assume the rowid is the second column - it's the last 2024-10-05 18:25:04 +03:00
jussisaurio
3a11887122 fixerinos 2024-10-05 18:25:04 +03:00
jussisaurio
ed19f47762 fix 2024-10-05 18:25:04 +03:00
jussisaurio
ff236c7781 Fix not advancing the cell index of pages 2024-10-05 18:25:04 +03:00
jussisaurio
99871bbeea yield on io 2024-10-05 18:25:04 +03:00
jussisaurio
e118b70127 fmt 2024-10-05 18:25:04 +03:00
jussisaurio
3d56fbd91c stuff 2024-10-05 18:25:04 +03:00
jussisaurio
f02da18acd index scan wip foo doesnt work yet 2024-10-05 18:25:04 +03:00
김선우
f592ed15c1 Add test to verify root and leaf splitting 2024-09-16 16:50:30 +09:00
김선우
28884181be Fix clippy 2024-09-15 16:23:27 +09:00
jussisaurio
b6e88ca883 cargo clippy --fix --allow-dirty && cargo fmt 2024-09-15 09:35:39 +03:00