Commit Graph

9862 Commits

Author SHA1 Message Date
Jussi Saurio
509486bc05 CI: run long fuzz tests and stress on every PR, use 2 threads for stress 2025-10-03 11:12:01 +03:00
Jussi Saurio
d2f5e67b25 Merge 'Fix COLLATE' from Jussi Saurio
Fixes the following problems with COLLATE:
- Fix: incorrectly used e.g. `x COLLATE NOCASE = 'fOo'` as index
constraint on an index whose column was not case-insensitively collated
- Fix: various ephemeral indexes (in GROUP BY, ORDER BY, DISTINCT) and
subqueries did not retain proper collation information of columns
- Fix: collation of a given expression was not determined properly
according to SQLite's rules
Adds TCL tests and fuzz test
Closes #3476
Closes #1524
Closes #3305

Reviewed-by: Preston Thorpe <preston@turso.tech>

Closes #3538
2025-10-03 09:34:24 +03:00
Pekka Enberg
33e727ce8f Merge 'core/mvcc: Return completions from logical log methods' from Pedro Muniz
`IOResult` implies we have a state machine that needs to be polled to
`Completion`, which is not the case here. We are just emitting the IO
operation in this case. This led us to never reaching the
`IOResult::Done` branch that actually fsynced the logical log in
`Checkpoint`.
I also sprinkled some
```rust
if c.is_completed() {
   Ok(TransitionResult::Continue)
} else {
   Ok(TransitionResult::Io(IOCompletions::Single(c)))
}
```
just to be more efficient with sync IO, but it is not strictly necessary
here.

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

Closes #3549
2025-10-03 09:29:31 +03:00
Pekka Enberg
4de5ea9d91 Merge 'Improve MCP configuration docs' from Jamie Barton
A little bit of docs restructuring for MCP client usage based on recent
user questions/feedback.

Closes #3410
2025-10-03 09:26:25 +03:00
Pekka Enberg
bd47237835 Merge branch 'main' into mcp-config-docs 2025-10-03 09:26:11 +03:00
pedrocarlo
131a5b8048 adjust logical log IO functions to return Completions and not IOResult 2025-10-03 01:44:41 -03:00
Pekka Enberg
f21230ed76 cli: Remove unused "--experimental-logical-log" option 2025-10-03 07:39:07 +03:00
Preston Thorpe
990740ab73 Merge 'core/vdbe: Don't clear cursors in ProgramState::reset()' from Pekka Enberg
We don't need to clear the cursors explicitly because OpenRead and
OpenWrite will anyway replace them.

Reviewed-by: Preston Thorpe <preston@turso.tech>

Closes #3526
2025-10-02 17:32:05 -04:00
Preston Thorpe
c30c1ca591 Merge 'core/translate: fix rowid affinity' from Preston Thorpe
closes https://github.com/tursodatabase/turso/issues/3478

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

Closes #3539
2025-10-02 16:37:59 -04:00
Jussi Saurio
58ea9e4c3c clippy 2025-10-02 21:49:33 +03:00
Jussi Saurio
8e2e557da4 Collate: fix Insn::Compare to use collation seq of each compared column 2025-10-02 21:49:33 +03:00
Jussi Saurio
edd4651b97 Collate: add proper collation info for GROUP BY sorter columns 2025-10-02 21:49:33 +03:00
Jussi Saurio
f02757fe11 Collate: add proper collation to FROM-clause subquery result cols 2025-10-02 21:49:33 +03:00
Jussi Saurio
edfe0cb4fe Collate: prevent using an index if collation sequences don't match 2025-10-02 21:49:33 +03:00
Jussi Saurio
d42f3c7cbb Collate: compute collations properly for ORDER BY 2025-10-02 21:49:33 +03:00
Jussi Saurio
5a5f49933d Collate: add proper collation info to DISTINCT indexes 2025-10-02 21:49:33 +03:00
Jussi Saurio
f4ee0457b2 Collate: add proper collation info to compound select deduplication indexes 2025-10-02 21:49:33 +03:00
Jussi Saurio
e1fcd7b5e9 Collate: add get_collseq_from_expr()
Determines collation sequence to use for a given Expr
based on SQLite collation rules.
2025-10-02 21:49:33 +03:00
Jussi Saurio
b351993cb0 Collate: add fuzz test 2025-10-02 21:49:33 +03:00
Jussi Saurio
ce7fe54841 Collate: add more TCL tests 2025-10-02 21:49:33 +03:00
PThorpe92
361bd70a26 Add regression test for rowid affinity 2025-10-02 14:31:22 -04:00
PThorpe92
43aba0ee95 Fix integer affinity for rowid expr type 2025-10-02 14:29:53 -04:00
Pekka Enberg
dc1463c70d Merge 'Improve error handling for cyclic views' from Duy Dang
The cycle is detected by marking a seen view, if a seen view is process
again, that's a cycle and we throw an error.
Close #3404

Closes #3467
2025-10-02 19:33:12 +03:00
Pekka Enberg
ed09403e70 Merge 'docs: Add section on MVCC limitations' from Pekka Enberg
Document limitations in MVCC pointed out by Jussi.

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

Closes #3519
2025-10-02 19:21:46 +03:00
Pekka Enberg
6d06dce2bb docs: Add section on MVCC limitations
Document limitations in MVCC pointed out by Jussi.
2025-10-02 18:49:12 +03:00
Pekka Enberg
b11246278f Merge 'Enable encryption properly in Rust bindings, whopper, and throughput tests' from Avinash Sajjanshetty
This is a follow up from PR - #3457 which requires users to opt in to
enable encryption. This patch
- Makes appropriate changes to Whopper and Encryption throughput tests
- Updated Rust bindings to pass the encryption options properly
- Added a test for rust bindings
To use encryption in Rust bindings, one needs to do:
```rust
let opts = EncryptionOpts {
    hexkey: "b1bbfda...02a5669fc76327".to_string(),
    cipher: "aegis256".to_string(),
};

let builder = Builder::new_local(&db_file).experimental_encryption(true).with_encryption(opts.clone());
let db = builder.build().await.unwrap();
```
We will remove the `experimental_encryption` once the feature is stable.

Closes #3532
2025-10-02 18:32:06 +03:00
Pekka Enberg
d3b6adfb2d Merge 'Enable checksums only if its opted in via feature flag' from Avinash Sajjanshetty
Reviewed-by: Nikita Sivukhin (@sivukhin)
Reviewed-by: bit-aloo (@Shourya742)

Closes #3523
2025-10-02 17:26:14 +03:00
Pekka Enberg
3378afe8c6 Merge 'Fix MVCC drop table' from Jussi Saurio
MVCC shuoldn't try to destroy btrees in pager because pager operations
are only done in checkpoint

Closes #3524
2025-10-02 17:26:00 +03:00
Pekka Enberg
78e3311c3b Merge 'Sync engine defered sync' from Nikita Sivukhin
This PR makes sync client completely autonomous as now it can defer
initial sync.
This can open possibility to asynchronously create DB in the Turso Cloud
while giving user ability to interact with local DB straight away.

Closes #3531
2025-10-02 17:25:11 +03:00
Avinash Sajjanshetty
3653c1a853 clear page cache when the encryption context is set 2025-10-02 19:50:12 +05:30
Avinash Sajjanshetty
306f681966 Add an encryption test in rust bindings 2025-10-02 19:50:10 +05:30
Avinash Sajjanshetty
36d4b09830 Use the updated bindings for encryption throughput tests 2025-10-02 19:04:15 +05:30
Nikita Sivukhin
649fddedf6 remove unnecessary clone 2025-10-02 17:31:30 +04:00
Avinash Sajjanshetty
4ee6bdac1b update Rust bindings to pass encryption options 2025-10-02 18:51:44 +05:30
Avinash Sajjanshetty
593fd5fb88 update Rust bindings to enable experimental encryption 2025-10-02 18:50:57 +05:30
Nikita Sivukhin
cff23c80cb fix wasm client 2025-10-02 16:56:54 +04:00
Nikita Sivukhin
39bf35abe9 adjust native sync client 2025-10-02 16:51:08 +04:00
Nikita Sivukhin
c0b6210756 add missed method in the core 2025-10-02 16:19:52 +04:00
Nikita Sivukhin
863e3fe94e make url parameter to accept either string or function 2025-10-02 16:17:36 +04:00
Nikita Sivukhin
64389447e3 support defered sync in the bindings core 2025-10-02 16:17:36 +04:00
Nikita Sivukhin
5ec2d96bc1 support defered sync in the engine 2025-10-02 16:17:36 +04:00
Nikita Sivukhin
7016d9456e fix test in the database tape 2025-10-02 16:17:36 +04:00
Nikita Sivukhin
91aeadd940 apply create DDL operation with IF NOT EXISTS clause in order to make them idempotent 2025-10-02 15:56:34 +04:00
Pekka Enberg
16f1c1ac8b core/vdbe: Don't clear cursors in ProgramState::reset()
We don't need to clear the cursors explicitly because OpenRead and
OpenWrite will anyway replace them.
2025-10-02 14:36:46 +03:00
Pekka Enberg
a44f965a45 Turso 0.2.0-pre.14 2025-10-02 14:29:22 +03:00
Pekka Enberg
7bfb4dc203 Merge 'Fix MVCC startup infinite loop when using existing DB' from Jussi Saurio
MVCC bootstrap connection got stuck into an infinite statement reparsing
loop because the bootstrap procedure happened before the on-disk schema
was deserialized.
closes #3518

Closes #3522
2025-10-02 14:20:42 +03:00
Jussi Saurio
0e3132d24b Dont try to destroy btree in mvcc mode 2025-10-02 14:12:12 +03:00
Jussi Saurio
bb82f26440 Modify DDL fuzz test to support MVCC too 2025-10-02 14:12:12 +03:00
Avinash Sajjanshetty
09ba4615ba return appropriate error if checksum was not compiled 2025-10-02 16:11:18 +05:30
Pekka Enberg
aa37d279ca Merge 'core/vdbe: Avoid cloning Arc<MvStore> on every VDBE step' from Pekka Enberg
The VDBE step() function was taking Arc<MvStore> by value, causing it to
be cloned on every single step of query execution. This resulted in
thousands of atomic reference count increments/decrements per query,
showing up as a major hotspot in profiling.
Changed step() and related functions to take Option<&Arc<MvStore>>
instead, passing a reference rather than cloning the Arc. This
eliminates the unnecessary atomic operations while maintaining the same
semantics.

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

Closes #3520
2025-10-02 13:41:14 +03:00