Commit Graph

3267 Commits

Author SHA1 Message Date
Pekka Enberg
ef32a82941 core/vdbe: Integrate MVCC transactions 2025-03-06 10:16:42 +02:00
Pekka Enberg
461be0dc87 core: Add multi-version store to Database 2025-03-06 10:16:42 +02:00
Pekka Enberg
96175cccf7 cli: Add --experimental-mvcc option to enable MVCC 2025-03-06 10:16:42 +02:00
Pekka Enberg
5d0982f5db core/mvcc: Add RowID::new() and Row::new() helpers 2025-03-06 09:59:40 +02:00
Pekka Enberg
4247974f95 core/mvcc: Add insert() helper to Cursor 2025-03-06 09:32:48 +02:00
Pekka Enberg
b7382ffab1 core/mvcc: Switch Cursor to use Rc instead of lifetimes 2025-03-06 09:31:34 +02:00
Pekka Enberg
ff6d9465eb core/mvcc: Improve trace logging 2025-03-06 09:31:04 +02:00
Pekka Enberg
92863c0d6b Merge 'Transaction finish lock fixes' from Pere Diaz Bou
While adding logs to our locks in `Wal` I noticed we weren't cleaning up
connection's transaction state. This PR set to `TransactionState::None`
once commited and calls `end_read_txn` and `end_tx` in case of write.
Fixes #1004

Reviewed-by: Pekka Enberg <penberg@iki.fi>

Closes #1099
2025-03-06 07:51:27 +02:00
Pere Diaz Bou
aa7391da50 fix halt return 2025-03-05 22:32:59 +01:00
Pere Diaz Bou
e4d22a22df ignore test again :) 2025-03-05 22:32:59 +01:00
Pere Diaz Bou
b555561aeb make Program::halt reentrant 2025-03-05 22:32:59 +01:00
Pere Diaz Bou
3492ed4641 remove unused import Add 2025-03-05 22:32:59 +01:00
Pere Diaz Bou
7aae885af4 add logs to wal locks 2025-03-05 22:32:59 +01:00
Pere Diaz Bou
7b1e2093e8 add multi threaded test for simple writer/reader test 2025-03-05 22:32:59 +01:00
Pere Diaz Bou
feeb398e73 finish transaction and reset transaction state 2025-03-05 22:32:59 +01:00
Pekka Enberg
3932309678 Merge 'core/mvcc: Eliminate row generic types' from Pekka Enberg
The logging code that writes out transactions to disk needs to write out
the byte array that we actually use. The code is less hairly without the
generics so drop them.

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

Closes #1100
2025-03-05 19:24:54 +02:00
Pekka Enberg
81b79bc833 core/mvcc: Eliminate row generic types
The logging code that writes out transactions to disk needs to write out
the byte array that we actually use. The code is less hairly without the
generics so drop them.
2025-03-05 19:17:16 +02:00
Pere Diaz Bou
c63286215e Merge 'Add tracing_subscriber and test_log::test' from Pere Diaz Bou
I don't know when and why we dropped log::* in favor of tracing but when
it was done, it made relevant logs not appear any more while debugging
so... I added test_log::test which helps by automatically adding info
logs from trace package (useful for printing seeds too).

Closes #1097
2025-03-05 16:03:51 +01:00
Pekka Enberg
acf0fb4425 scripts: Add missing parser crate to publish-crates.sh 2025-03-05 16:56:50 +02:00
Pere Diaz Bou
a79b3f5746 remove unused imports test_wal.rs 2025-03-05 15:52:10 +01:00
Pere Diaz Bou
5c0d44d0d8 test_wal conditional setup tracing 2025-03-05 15:42:04 +01:00
Pere Diaz Bou
262c4de548 add line number and thread id to tracing logs 2025-03-05 15:36:47 +01:00
Pere Diaz Bou
9a01e32c01 add tracing_subscriber and test_log::test
I don't know when and why we dropped log::* in favor of tracing but when it was done, it made relevant logs not appear any more while debugging so... I added test_log::test which helps by automatically adding info logs from trace package.
2025-03-05 15:36:06 +01:00
Pere Diaz Bou
a7f3579a0a Merge 'Bunch Database changes to prepare for multi threading.' from Pere Diaz Bou
This is an umbrella PR for multi threading where I modify the following:
* Loaded extensions (`syms`) are now moved to `Connection` as loading
extensions in SQLite is per connection and not per database.
* `Schema` is not a `RWLock` so that it behaves equally to SQLite where
schema changes block preparing new statements.
* Sprinkled a bunch of `unsafe impl Send` and `unsafe impl Sync` on top
of all `IO` implementations and inner structures for now in order to
allow multi threading. Ideally this will be enforced with transaction
locks and internal locks instead of throwing a bunch of mutexes like
rust would like us to do -- this means the work is not finished and
rather started for future improvements.

Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #1091
2025-03-05 15:30:07 +01:00
Pere Diaz Bou
5f5ca50c41 Move schema lock read to translate only 2025-03-05 14:07:48 +01:00
Pere Diaz Bou
b63f541150 impl Send Sync for GenericFile 2025-03-05 14:07:48 +01:00
Pere Diaz Bou
d1e7f0826b impl Send Sync for WindowsFile 2025-03-05 14:07:48 +01:00
Pere Diaz Bou
3d3cdbeb0c fix generic and windows sync compilation 2025-03-05 14:07:48 +01:00
Pere Diaz Bou
ab2fc3fb13 fix clippy arc warnings for now 2025-03-05 14:07:48 +01:00
Pere Diaz Bou
d1c7d758c4 fix uring Sync,Sync unsafe impl 2025-03-05 14:07:48 +01:00
Pere Diaz Bou
47cd54a7fe remove schema comment 2025-03-05 14:07:48 +01:00
Pere Diaz Bou
17bf67e8a9 Add first multi threaded test which fails. 2025-03-05 14:07:48 +01:00
Pere Diaz Bou
e20dd59353 Make schema a RWLock
This makes it work like in SQLite where only one schema writer is permitted and readers will return error while preparing statement if the schema is changing.
2025-03-05 14:07:48 +01:00
Pere Diaz Bou
e4a8ee5402 move load extensions to Connection
Extensions are loaded per connection and not per database as per SQLite
behaviour. This also helps with removing locks.
2025-03-05 14:07:48 +01:00
Pere Diaz Bou
0149e86356 add todo comments to remove mutex from database structures 2025-03-05 14:07:48 +01:00
Pere Diaz Bou
8daf7666d1 Make database Sync + Send 2025-03-05 14:07:48 +01:00
Pere Diaz Bou
205cd148ca Merge 'Enable local file connection in Rust binding' from 南宫茜
It's so weird that other bindings can open local file but Rust binding
itself cannot.

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

Closes #1095
2025-03-05 14:05:35 +01:00
Pere Diaz Bou
8012c3484a Merge 'Shell command completion' from Pedro Muniz
This PR adds tab completion to the CLI app. To achieve that I
implemented a simplified, but similar, Vtable that given a prefix and a
line, it outputs rows of candidates. Currently, it only supports auto
completion for SQLite keywords, but in the future we can autocomplete
database names and columns when `PRAGMA database_list` is implemented.
Also, some work will need to be done for detecting whether some syntax
would be legal in certain scenarios, but I think this is better
delegated to a future PR.

Closes #1050
2025-03-05 14:04:30 +01:00
Pedro Muniz
c75e1ce263 Merge branch 'main' into completions 2025-03-05 09:47:48 -03:00
Pekka Enberg
49b75d33ba Limbo 0.0.16 2025-03-05 13:46:17 +02:00
南宫茜
71921ee178 Enable local file connection in Rust binding
It's so weird that other bindings can open local file but Rust binding itself cannot.
2025-03-05 17:38:23 +08:00
pedrocarlo
5d5e6be7dd cleanup comments 2025-03-04 14:44:11 -03:00
pedrocarlo
168a2deffb merging changes from extension cleanup PR 2025-03-04 14:43:07 -03:00
pedrocarlo
04d7d8ab87 autocomplete working 2025-03-04 14:43:07 -03:00
pedrocarlo
99d979eb80 first version of vtable with keyword autocomplete 2025-03-04 14:43:07 -03:00
pedrocarlo
ca574651d9 wip 2025-03-04 14:42:13 -03:00
Pekka Enberg
9f1b43d06d Merge 'Adjust codeowners order' from Pere Diaz Bou
Last matched pattern is the one that will be used, this fixes it.

Closes #1092
2025-03-04 19:25:05 +02:00
Pekka Enberg
0f8bfefe6e Merge 'core: Clean up B-Tree creation code' from Pekka Enberg
Move page allocation to pager so that we don't need to instantiate a
cursor to create a B-Tree.

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

Closes #1093
2025-03-04 19:24:44 +02:00
Pekka Enberg
f57d2b32af core: Clean up B-Tree creation code
Move page allocation to pager so that we don't need to instantiate a
cursor to create a B-Tree.
2025-03-04 18:38:06 +02:00
Pere Diaz Bou
025f96e9bb adjust codeowners order 2025-03-04 17:30:50 +01:00