Commit Graph

5939 Commits

Author SHA1 Message Date
Jussi Saurio
d88bbd488f btree/balance: rename leaf_data to is_table_leaf 2025-07-10 13:15:29 +03:00
Jussi Saurio
b306550a69 format 2025-07-10 13:14:57 +03:00
Jussi Saurio
5ef0127409 btree/balance: rename count_cells_in_old_pages to old_cell_count_per_page_cumulative 2025-07-10 13:14:18 +03:00
Jussi Saurio
c31ee0e628 btree/balance: rename number_of_cells_per_page to cell_count_per_page_cumulative 2025-07-10 13:12:17 +03:00
Jussi Saurio
824065a91d btree/balance: rename cells to cell_data 2025-07-10 13:10:31 +03:00
Jussi Saurio
37f2317e49 btree/balance: add comment about divider cell 2025-07-10 13:09:29 +03:00
Jussi Saurio
4d691af3ee btree/balance: clearer variable name 2025-07-10 13:08:58 +03:00
Jussi Saurio
e51f0f5466 btree/balance: improve comment 2025-07-10 13:08:35 +03:00
Jussi Saurio
201edf3668 btree/balance: add comment 2025-07-10 13:05:54 +03:00
Jussi Saurio
fd0a47dc6b btree: simplify pattern match 2025-07-10 13:05:15 +03:00
Jussi Saurio
4dc3e2100f btree: rename balance_non_root related enum variants and add docs 2025-07-10 13:02:50 +03:00
Jussi Saurio
0eeabbb748 Merge 'btree/chore: remove unnecessary parameters to .cell_get()' from Jussi Saurio
we were providing the same damn arguments to `.cell_get()` and
`.cell_get_raw_region()` over and OVER and **OVER** and `O V E R`

Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #2021
2025-07-10 12:22:37 +03:00
Pekka Enberg
0f4bd65476 Merge 'core/btree: Make cell field names consistent' from Jussi Saurio
Closes #2025
2025-07-10 10:18:22 +03:00
Pekka Enberg
d7b7d48046 Merge 'Enforce TCL 8.6+ in compatibility tests' from Mikaël Francoeur
The compatibility test suite fails on older versions of TCL, because
they didn't handle characters outside the Basic Multilingual Plane (BMP)
properly. TCL 8.6 fixed this problem ([source](https://wiki.tcl-
lang.org/page/emoji+with+Tcl%2FTk+8.6)).
MacOS comes with an older TCL 8.5.9, so running compatibility tests
locally on the default TCL will give this error:
```
(testing/testing.db)                        Running test: unicode-emoji
Test FAILED: SELECT unicode('🠘 Š ');
returned '240'
expected '128522'
make: *** [test-compat] Error 1
```
This PR adds a target in the Makefile to enforce that TCL 8.6+ is used.
If not, it will fail with a message like this:
```
tclsh 9.0.2 found — need 11.12.13+
make: *** [check-tcl-version] Error 1
```

Closes #2020
2025-07-10 10:17:19 +03:00
Pekka Enberg
474c1bff3b Turso 0.1.2-pre.2 2025-07-10 10:10:52 +03:00
Pekka Enberg
b2d40d95d3 Sort partners in alphabetical order in README.md 2025-07-10 09:05:11 +03:00
Pekka Enberg
6418ff6b33 Merge 'Add Nyrkiö to partners section in README' from Henrik Ingo
Hi
I noticed you have some partner logos in the README nowadays, and felt
left out... But then I realized this is open source and I can just send
a PR.  I assume the order is chronological so as Nyrkiö is the oldest of
these three I put it on  top. The order could also be reverse
alphabetical.

Closes #2027
2025-07-10 09:03:49 +03:00
Henrik Ingo
fe4f2e17c3 Add Nyrkiö to partners section in README 2025-07-10 04:54:24 +03:00
Jussi Saurio
c2b699c356 btree: make cell field names consistent 2025-07-09 23:43:03 +03:00
Jussi Saurio
641df7d7e9 improve my mental health by finally refactoring .cell_get() 2025-07-09 19:15:05 +03:00
Jussi Saurio
24219d2eb2 Merge 'Minor refactoring of btree' from meteorgan
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #1917
2025-07-09 19:13:39 +03:00
Mikaël Francoeur
a57c4c1b6e enforce tcl 8.6+ 2025-07-09 11:30:38 -04:00
Pekka Enberg
159710d1c9 Merge 'core: Fix resolve_function() error messages' from Pekka Enberg
We need to return the original function name, not normalized one to be
compatible with SQLite.
Spotted by SQLite TCL tests.

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

Closes #2017
2025-07-09 17:12:58 +03:00
meteorgan
0001348158 Minor refactoring of btree 2025-07-09 22:01:54 +08:00
Pekka Enberg
3f10427f52 core: Fix resolve_function() error messages
We need to return the original function name, not normalized one to be
compatible with SQLite.

Spotted by SQLite TCL tests.
2025-07-09 15:30:57 +03:00
Pekka Enberg
91fff1d2b3 Merge 'bindings/python: Start transaction implicitly in execute()' from Pekka Enberg
We need to start transaction implicitly in execute() for DML statements
to make sure first transaction is actually started.
Fixes #2002

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

Closes #2013
2025-07-09 14:34:02 +03:00
Jussi Saurio
1113e34c47 Merge 'VDBE: fix op_insert re-entrancy' from Jussi Saurio
when updating last_insert_rowid we call `return_if_io!(cursor.rowid())`
which yields IO on large records. this causes `op_insert` to insert and
overwrite the same row many times. we need a state machine to ensure
that the insertion only happens once and the reading of `rowid` can
independently yield IO without causing a re-insert.
to reproduce this bad behavior:
```sql
create table t(x);
insert into t values (randomblob(1024*1024));
```

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

Closes #2000
2025-07-09 14:31:21 +03:00
Jussi Saurio
c9a6c289e0 clippy 2025-07-09 14:26:43 +03:00
Jussi Saurio
38650eee0e VDBE: fix op_insert re-entrancy
when updating last_insert_rowid we call return_if_io!(cursor.rowid())
which yields IO on large records. this causes op_insert to insert and
overwrite the same row many times. we need a state machine to ensure
that the insertion only happens once and the reading of rowid can
independently yield IO without causing a re-insert.
2025-07-09 14:26:40 +03:00
Jussi Saurio
11d4489740 Merge 'sqlite3_ondisk: generalize left-child-pointer reading function to both index/table btrees' from Jussi Saurio
Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #2015
2025-07-09 14:24:08 +03:00
Jussi Saurio
12a9f86779 Merge 'VDBE: fix op_idx_insert re-entrancy' from Jussi Saurio
Separates cursor.key_exists_in_index() into a state machine. The problem
with the main branch implementation is this:
`return_if_io!(seek)`
`return_if_io!(cursor.record())`
The latter may yield on IO and cause the seek to start over, causing an
infinite loop. With an explicit state machine we can control and prevent
this.

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

Closes #2011
2025-07-09 14:21:13 +03:00
Pekka Enberg
d1a775e445 Merge 'sim: post summary to slack' from Jussi Saurio
Closes #2016
2025-07-09 13:47:52 +03:00
Jussi Saurio
85ef8dd2e6 sim: post summary to slack 2025-07-09 13:30:42 +03:00
Pekka Enberg
6b4dda8b9b Merge 'bindings/javascript: Improve error handling compatibility with better-sqlite3' from Mikaël Francoeur
This PR brings the error handling of the js bindings one step closer to
better-sqlite3. There is still some work left for the error handling to
be 100% compatible.
This is my first non-trivial Rust PR, so if you have any comments that
can help me improve, please leave them on the PR.
-----
as part of https://github.com/tursodatabase/turso/issues/1900

Reviewed-by: Diego Reis (@el-yawd)

Closes #2009
2025-07-09 12:16:28 +03:00
Jussi Saurio
c752058a97 VDBE: introduce state machine for op_idx_insert for more granular IO control
Separates cursor.key_exists_in_index() into a state machine. The problem with
the main branch implementation is this:

`return_if_io!(seek)`
`return_if_io!(cursor.record())`

The latter may yield on IO and cause the seek to start over, causing an infinite
loop. With an explicit state machine we can control and prevent this.
2025-07-09 11:43:18 +03:00
Jussi Saurio
c13b2d5d90 sqlite3_ondisk: generalize left-child-pointer reading function to both index/table btrees 2025-07-09 11:07:42 +03:00
Pekka Enberg
5216e67d53 bindings/python: Start transaction implicitly in execute()
We need to start transaction implicitly in execute() for DML statements
to make sure first transaction is actually started.

Fixes #2002
2025-07-09 10:59:52 +03:00
Jussi Saurio
6faa07505c Merge 'uv run ruff format && uv run ruff check --fix' from Jussi Saurio
Closes #2012
2025-07-09 10:50:56 +03:00
Jussi Saurio
b1d51aadc5 Merge 'stress clippy' from Jussi Saurio
Closes #2014
2025-07-09 10:50:43 +03:00
Jussi Saurio
1bda8bb47a stress clippy 2025-07-09 10:41:18 +03:00
Pekka Enberg
a1ab0f12ea stress: Make error reporting less verbose by default 2025-07-09 10:18:23 +03:00
Jussi Saurio
f312227825 uv run ruff format && uv run ruff check --fix 2025-07-09 10:06:29 +03:00
Pekka Enberg
3e898cceb9 Merge 'Synchronize WAL checkpointing' from Pere Diaz Bou
Closes #2007
2025-07-09 09:40:26 +03:00
Pekka Enberg
943793a571 Turso 0.1.2-pre.1 2025-07-09 09:27:31 +03:00
Pekka Enberg
cf47097f45 Turso v0.1.2-pre.1 2025-07-09 09:27:25 +03:00
Pekka Enberg
1e9fd7d5ed Add scripts/gen-changelog.py 2025-07-09 09:27:09 +03:00
Pere Diaz Bou
f7465f665d add checkpoint lock to wal 2025-07-08 17:53:04 +02:00
Pekka Enberg
d0a80c6acd Merge 'Support except operator for Compound select ' from meteorgan
Closes: #1574

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

Closes #1858
2025-07-08 18:48:36 +03:00
Mikaël Francoeur
2a691f5044 make some errors compatible with better-sqlite3 2025-07-08 11:36:23 -04:00
meteorgan
99e0cf0603 add a constant MINIMUM_CELL_SIZE 2025-07-08 22:57:20 +08:00