Commit Graph

60 Commits

Author SHA1 Message Date
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
86a4714711 syntactic changes: remove unneeded paths when the type is already imported 2025-01-18 18:29:12 +01:00
Pekka Enberg
d355ce785c core/storage: Remove debug printout 2025-01-14 17:54:17 +02:00
PThorpe92
0b6061de2f Adjust sqlite serial type to account for single byte signed integer 2025-01-13 13:34:46 -05:00
Ziyak Jehangir
4f119f4b95 refactor: simplify database header write logic 2025-01-04 14:31:23 +05:30
PThorpe92
f6cd707544 Add clippy CI, fix or ignore warnings where appropriate 2024-12-29 10:25:41 -05: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
c727ed7e8a rename cell_start to cell_pointer_array_start, part 2: electric boogaloo 2024-12-23 22:31:35 +02:00
jussisaurio
17440393f5 rename cell_start to cell_pointer_array_start 2024-12-23 22:30:05 +02:00
jussisaurio
81526089a4 add comment about cell_get_raw_pointer_region() 2024-12-23 22:26:49 +02:00
jussisaurio
668a0ecae8 comment about page header size difference between page types 2024-12-23 22:18:22 +02:00
jussisaurio
9ea4c95ee1 even more comments 2024-12-23 22:07:20 +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
Kacper Madej
19ae42dfa3 Implement json_array 2024-12-20 11:15:48 +01:00
Pere Diaz Bou
39a75147d4 Page cache by page_number and frame_number
Since page cache is now shared by default, we need to cache pages by
page number and something else. I chose to go with max_frame of
connection, because this connection will have a max_frame set until from
the start of a transaction until the end of it.

With key pairs of (pgno, max_frame) we make sure each connection is
caching based on the snapshot it is at as two different connections
might have the same pageno being using but a different frame. If both
have same max_frame then they will share same page.
2024-12-13 21:57:27 +01:00
Pere Diaz Bou
97dd95abea core: change Rc<RefCell<Page>> to Arc<Page>
This includes an inner struct in Page wrapped with Unsafe cell to access
it. This is done intentionally because concurrency control of pages is
handled by pages and not by the page itself.
2024-12-13 13:09:13 +01:00
Pere Diaz Bou
3fda2d09b9 Extract multi threaded part from WalFile to WalFileShared
Since we expect to ensure thread safety between multiple threads in the
future, we extract what is important to be shared between multiple
connections with regards to WAL.

This is WIP so I just put whatever feels like important behind a RwLock
but expect this to change to Atomics in the future as needed. Maybe even
these locks might disappear because they will be better served with
transaction locks.
2024-12-13 13:09:13 +01:00
Lauri Virtanen
afeb1cbe74 Clippy warning fixes 2024-11-24 20:24:47 +02:00
Lauri Virtanen
a7100d8e9b Autofix clippy issues with cargo fix --clippy 2024-11-24 20:24:47 +02:00
Pere Diaz Bou
05a05cfc63 endian naming changes 2024-11-21 11:55:36 +01:00
Pere Diaz Bou
6c14c50d41 wal: checksums
Implemeted checksums so that sqlite3 is able to read our WAL. This also
helps with future work on proper recovery of WAL.

Create some frames with CREATE TABLE and kill the process so that there
is no checkpoint.
```
Limbo v0.0.6
Enter ".help" for usage hints.
limbo> create table x(x);
limbo> [1]    15910 killed     cargo run xlimbo.db
```

Now sqlite3 is able to recover from this WAL created in limbo:

```
sqlite3 xlimbo.db
SQLite version 3.43.2 2023-10-10 13:08:14
Enter ".help" for usage hints.
sqlite> .schema
CREATE TABLE x (x);
```
2024-11-20 20:12:32 +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
Pere Diaz Bou
db343ac5ea fix page1 balancing 2024-11-18 16:25: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
94a45eab9e checkpoint inflight 2024-11-13 12:04:54 +00:00
Pere Diaz Bou
cbfb45e55b more trace logs 2024-11-13 11:31:22 +00:00
Pere Diaz Bou
8d1d2d36cc core/linux: aligned wal header read 2024-11-12 17:53:59 +00:00
Pere Diaz Bou
48f0e72e14 checkpoint on drop connection 2024-11-12 17:03:30 +01: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
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
0b46648c0e write wal header on init 2024-11-07 13:29:57 +01:00
Pere Diaz Bou
a85d599c65 state machine cacheflush 2024-11-05 15:29:54 +01:00
Pere Diaz Bou
fc65c5096d cacheflush state machine 2024-11-05 15:29:54 +01:00
Pere Diaz Bou
c0e51c4ca6 wip wal 2024-11-05 15:29:53 +01:00
김선우
bbd1eea9ae Add support for parenthesized conditions 2024-09-21 16:03:49 +09:00
김선우
e9ba458514 Add support for sqlite_version 2024-09-18 17:57:51 +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
Pere Diaz Bou
6f30b67ec4 fix overflow range read 2024-09-13 21:34:45 +02:00
Pere Diaz Bou
e9bc4b04a7 overflow pages support 2024-09-13 20:32:33 +02:00
Pere Diaz Bou
4316a5f4c3 simplify filling a cell 2024-09-13 11:39:03 +02:00
Pere Diaz Bou
d87f9c9774 core: multiple level btree page split
Signed-off-by: Pere Diaz Bou <pere-altea@hotmail.com>
2024-09-05 20:50:30 +02:00
Pere Díaz
19f000238c core: simplify page buffer handling 2024-08-25 12:48:37 +02:00
Kim Seon Woo
78817d3804 Fix insert error 2024-08-18 21:00:03 +02:00
Kim Seon Woo
f406481849 Explain why it fails 2024-08-18 21:00:03 +02:00