Commit Graph

3246 Commits

Author SHA1 Message Date
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
Pekka Enberg
d2cf4c42cb Merge 'Cursor cleanups' from Pekka Enberg
Clean up the cursor lookup code in VDBE in preparation for multi-version
cursor support.

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

Closes #1090
2025-03-04 15:38:58 +02:00
Pekka Enberg
f3ee86d784 core/vdbe: Replace get_btree_{table,index}_cursor() calls with get_cursor() 2025-03-04 15:17:57 +02:00
Pekka Enberg
cdcaebb878 core/vdbe: Unify B-Tree cursors 2025-03-04 14:35:40 +02:00
Pekka Enberg
8e56646b12 Merge 'core/vdbe: Kill call_external_function macro' from Pekka Enberg
The call_external_function macro has exactly one call-site and,
therefore, only makes the code harder to read.

Closes #1089
2025-03-04 14:32:20 +02:00
Pekka Enberg
1c0d9c3b46 core/vdbe: Replace get_pseudo_cursor() calls with get_cursor() 2025-03-04 14:18:52 +02:00
Pekka Enberg
c12f2aeca4 core/vdbe: Replace get_sorter() calls with get_cursor() 2025-03-04 13:51:05 +02:00
Pekka Enberg
45539a4fe5 core/vdbe: Replace get_vtab_cursor() calls with get_cursor() 2025-03-04 13:43:49 +02:00
Pekka Enberg
085f93ce79 core/vdbe: Add ProgramState::get_cursor() helper 2025-03-04 12:23:35 +02:00
Pekka Enberg
3aeb11b673 core/vdbe: Add ProgramStatem::get_btree_{table,index}_cursor() helpers 2025-03-04 11:40:43 +02:00
Pekka Enberg
222808ab6c ore/vdbe: Add ProgramState::get_pseudo_cursor() helper 2025-03-04 11:21:24 +02:00
Pekka Enberg
06446b768b core/vdbe: Add ProgramState::get_sorter() helper 2025-03-04 11:18:09 +02:00
Pekka Enberg
e4ebb6d9e1 core/vdbe: Add ProgramState::get_vtab_cursor() helper 2025-03-04 11:16:29 +02:00
Pekka Enberg
dc525dd7d1 core/vdbe: Kill call_external_function macro
The call_external_function macro has exactly one call-site and,
therefore, only makes the code harder to read.
2025-03-04 11:01:09 +02:00
Pekka Enberg
19a348c91a Merge 'Print seed for failed fuzz tests' from Pedro Muniz
Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #1047
2025-03-04 10:25:47 +02:00
Pekka Enberg
ddb188132c Merge 'Clean up extension types API, introduce json text subtype' from Preston Thorpe
This PR cleans up some comments in the extension API and prevents
extensions themselves from calling 'free' on Value types that are
exposed to the user facing traits, as well as changes the `from_ffi`
method for OwnedValues to take ownership and automatically free the
values to prevent memory leaks.
This PR also finds the name of the `args: &[Value]` argument for scalar
functions in extensions, and uses that in the proc macro, instead of
relying on documentation to communicate that the parameter must be named
`args`.

Closes #1054
2025-03-04 10:24:19 +02:00
Pekka Enberg
13ae224cf7 Merge 'Minor improvements to extension docs' from Pedro Muniz
Reviewed-by: Preston Thorpe (@PThorpe92)
Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #1059
2025-03-04 10:23:38 +02:00
Pekka Enberg
2e4c18dca2 Merge 'Escape character is ignored in LIKE function' from lgualtieri75
Fixes #1051

Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #1074
2025-03-04 10:23:09 +02:00
Pekka Enberg
01f121b567 Merge 'adding limbo.quit to cleanly quit the subprocess in python tests' from Pedro Muniz
Closes #1071
2025-03-04 10:21:49 +02:00
Pekka Enberg
cedfa92b22 Merge 'Add sqlean ipaddr extension' from EmNudge
Relatively simple one, although I notice we don't have a lot of testing
here. The extensions have all their tests in the python cli extension
tests. Do we want to keep it that way or motivate inline rust tests for
these modules?

Closes #1081
2025-03-04 10:21:11 +02:00
Pekka Enberg
8a3bdbfdf3 Merge 'Add "dump" and "load" to the help menu' from EmNudge
These 2 were missing from the help menu and are both pretty useful.
Noticed `.exit` is also missing, ambivalent about this one since it's
rarely needed.
Also removed all ending periods to make these consistent (sqlite uses
this punctuation style as well)

Closes #1072
2025-03-04 10:16:59 +02:00
Pekka Enberg
bb79aeeb08 Merge 'bindings/java: Implement returning updated counts and version information ' from Kim Seon Woo
### Purpose
- Do some minor nits
  - Implement logic that returns updated count when running
executeUpdate
  - Implement version related functions
### Reference
- https://github.com/tursodatabase/limbo/issues/615

Closes #1086
2025-03-04 09:38:32 +02:00