Commit Graph

10220 Commits

Author SHA1 Message Date
pedrocarlo
d3bb8beb17 Run SQLite integrity check after stress test run 2025-10-14 13:50:50 -03:00
Pekka Enberg
7cf51e74ca Merge 'core/mvcc: implement CursorTrait on MVCC cursor' from Pere Diaz Bou
Closes #3714
2025-10-14 10:24:42 +03:00
Pekka Enberg
07b94faeb7 Merge 'Add test case for vector() format crash' from Pedro Muniz
Added test to close #1454. The Go code incorrectly, did not quote the
vector array.

Closes #3716
2025-10-14 09:37:11 +03:00
Pekka Enberg
9822fc2c90 Merge 'bindings/rust: Bump version recommendation to 0.2' from Kyle Kelley
Bump version number for crate docs starter setup

Closes #3711
2025-10-14 09:32:07 +03:00
Pekka Enberg
9a1bd2112d Merge 'Run simulator under Miri' from Bob Peterson
This adds support for running the simulator under Miri to detect UB.
There are a few things to note about Miri and its limitations
- It has limited `libc` coverage, so it's not really possible to have
Miri help with `UringIO`/`UringFile` or `UnixIO`/`UnixFile`. That's a
big gap ☹️
- It **can** work for `GenericIO`/`GenericFile`, which only uses `std`
- It can't call external C libraries, so even using `sqlite` is out
(hence adding `--disable-integrity-check` to the simulator for Miri use)
- It runs on nightly, consequently there are a few new lints that don't
exist on turso's pinned version of rustc
Some questions I have about this MR
- I made `GenericFile::{lock_file,unlock_file}` noops so I could use
`GenericIO`. This isn't great, but if/when you update from Rust 1.88.0
to 1.89.0, `std::File::{lock,lock_shared,unlock}` will be stabilized and
available. Should I note that as a TODO or something?
- Previously, the sim runner shelled out to `git` to get stuff like the
current git hash and the repo directory. For Miri, that's out, and so is
`git2`. Unfortunately, `gix` is also out since it has a required
dependency that uses inline assembly, which Miri doesn't like. I wrote a
hacky shim that uses only std to look for `.git` and find the hash that
HEAD is pointing to. It doesn't deal with stuff like packed-refs or the
repo being a secondary one made with `git worktree`. I'm happy to
support that, but wanted to hear from maintainers before doing more
work.
Two UB occurrences I already found:
- `TursoRwLock::read` used `AtomicU64::compare_exchange_weak`, which is
(evidently) [allowed to spuriously fail](https://doc.rust-lang.org/std/s
ync/atomic/struct.AtomicU64.html#method.compare_exchange_weak) in
exchange for perf. Miri forces this behavior, which triggers trivial
read deadlocks even with zero readers/writers. I changed it to
`compare_exchange`, but I'm not an atomics expert.
- Uninitialized read in non-Unix
`core::storage::buffer_pool::arena::alloc`. This is a simple one,
resolved by using `std::alloc::alloc_zeroed` instead of
`std::alloc::alloc`
Moving forward, I'd be interested in potentially getting the tests to
run in Miri, too. `tokio` looks like a good example of a project with
partial coverage that runs it where they can. They have some extra test
config to allow as many as possible to run under Miri, with
appropriately scaled-down parameter values since Miri is super slow

Closes #3720
2025-10-14 09:26:55 +03:00
Pekka Enberg
829ca291f9 Merge 'Import workspace crates by name and not path' from Pedro Muniz
Reviewed-by: bit-aloo (@Shourya742)

Closes #3725
2025-10-14 09:25:13 +03:00
Jussi Saurio
4e34c6be51 Merge 'names shall not be shared between tables,indexs,vtabs,views' from Pavan Nambi
closes #3675

Closes #3681
2025-10-14 07:30:37 +03:00
Jussi Saurio
bd15fee1f8 Merge 'Get aliases to where shall they be used' from Pavan Nambi
closes #3678

Closes #3680
2025-10-14 07:28:09 +03:00
Jussi Saurio
cce2bf9328 Merge 'Add correct unique constraint test for tcl' from Pedro Muniz
Closes #1710
We should use `do_execsql_test_in_memory_error_content` to test errors
instead

Closes #3718
2025-10-14 07:26:48 +03:00
Jussi Saurio
1aed9c9694 Merge 'remove cfg for MAP_ANONYMOUS' from Pedro Muniz
Related to #2587

Reviewed-by: Preston Thorpe <preston@turso.tech>
Reviewed-by: bit-aloo (@Shourya742)

Closes #3721
2025-10-14 07:26:09 +03:00
Jussi Saurio
ebc4ddb2a2 Merge 'Simulator: fix alter table shadowing to modify index column name ' from Pedro Muniz
Forgot to modify the column name referenced in the indexes when
shadowing

Reviewed-by: bit-aloo (@Shourya742)

Closes #3712
2025-10-14 07:25:29 +03:00
Jussi Saurio
a710d2f124 Merge 'Simulator: Drop Index' from Pedro Muniz
Added the ability for us to generate `Drop Index` queries in the
simulator. Most of the code is just boilerplate and some checks to make
sure we do not generate `Drop Index` when we have no indexes to drop

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>
Reviewed-by: bit-aloo (@Shourya742)

Closes #3713
2025-10-14 07:25:02 +03:00
Jussi Saurio
61109963fc Merge 'fix backwards compatible rowid alias behaviour' from Pedro Muniz
Closes #3665

Closes #3723
2025-10-14 07:24:42 +03:00
pedrocarlo
5b2cce946a do not reference workspace package by path 2025-10-13 21:07:15 -03:00
pedrocarlo
2e722af93c proof issue 1710 2025-10-13 20:51:21 -03:00
pedrocarlo
83dde9b55c fix backwards compatible rowid alias behaviour 2025-10-13 20:41:45 -03:00
pedrocarlo
0ef5ec007c remove cfg for MAP_ANONYMOUS 2025-10-13 18:05:18 -03:00
Bob Peterson
4d843804b7 Add --disable-integrity-check option to simulator
Miri can't execute sqlite via the FFI, so this needs to be configurable
2025-10-13 14:54:16 -05:00
Bob Peterson
3d4c10df40 Document using Miri to run the simulator 2025-10-13 14:54:16 -05:00
Bob Peterson
dfc77b0350 Non-Unix arena: use zeroed alloc to avoid UB
Reads to the arena were flagged by Miri as UB since it contained
uninitialized memory
2025-10-13 14:54:16 -05:00
Bob Peterson
74ef9ad5ca Drop weak in TursoRwLock::read's compare_exchange
compare_exchange_weak can spuriously fail, which Miri obliges us with,
causing a read deadlock
2025-10-13 14:54:16 -05:00
Bob Peterson
ce2f286df0 Replace git shell commands with std shims
gix doesn't work here, since while it's pure Rust, it has a
non-configurable dependency on crates using inline assembly, which Miri
does not support. This commit is a bit of a hack, and only works in
non-bare git repos without e.g packed-refs.
2025-10-13 14:54:16 -05:00
Bob Peterson
cd56f52bd6 Add cfg attributes for running under Miri 2025-10-13 14:54:16 -05:00
pedrocarlo
2798fafa6c proof issue 1454 2025-10-13 16:14:29 -03:00
Bob Peterson
bd62c80536 Implement generic file lock/unlock as a noop 2025-10-13 12:54:10 -05:00
Pere Diaz Bou
bc05497d99 core/mvcc: implement CursorTrait on MVCC cursor 2025-10-13 19:26:18 +02:00
pedrocarlo
45567e6837 fix alter table shadowing to modify index column name on rename and alter 2025-10-13 14:02:26 -03:00
pedrocarlo
bfeccf6543 integrate DropIndex in query generator 2025-10-13 13:56:36 -03:00
Kyle Kelley
f7ba978701 Recommend 0.2 in rust bindings
Bump version number for crate docs starter setup
2025-10-13 09:33:58 -07:00
pedrocarlo
b2e54d9816 add Drop Index to simulator model 2025-10-13 13:32:16 -03:00
pedrocarlo
294f842e62 DROP INDEX sql generation 2025-10-13 13:23:44 -03:00
Pekka Enberg
42de657b5c Merge 'Fix typo in manual.md' from Yevhen Kostryka
In `SELECT` section there is `GROU BY` instead of `GROUP BY`

Closes #3710
2025-10-13 18:55:07 +03:00
Yevhen Kostryka
08efce510e Fix typo in manual.md
In `SELECT` section there is `GROU BY` instead of `GROUP BY`
2025-10-13 18:45:31 +03:00
Pekka Enberg
1c9eaa3d95 Merge 'Restrict joins to max 63 tables and allow arbitrary number of table columns' from Jussi Saurio
Closes #2076
Closes #2075

Closes #3705
2025-10-13 18:23:11 +03:00
Pavan-Nambi
57a06835bf add test and fmt and clippy
i was stupid

remove comment
2025-10-13 18:07:51 +05:30
Jussi Saurio
c54e150a52 Merge 'Fix: Table entry is not removed from sqlite_schema when a table is dropped' from
Fixes #3682 .
Ignore case of table name when dropping table.

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

Closes #3683
2025-10-13 15:02:29 +03:00
Jussi Saurio
c12c1db275 Merge 'Simulator: persist files in sim memory IO for integrity check' from Pedro Muniz
If we don't persist the files, rusqlite will open an empty file and
perform integrity check on it.

Reviewed-by: bit-aloo (@Shourya742)

Closes #3676
2025-10-13 14:23:53 +03:00
Jussi Saurio
c2deee1ce5 Merge 'Simulator: ALTER TABLE' from Pedro Muniz
Adds `ALTER TABLE` to the simulator. Currently, there are no properties
that generate `ALTER TABLE`. The query is only generated in
`Property::Query` or in extension queries.
Conditions to generate `ALTER TABLE`:
- In differential testing, do not generate `ALTER COLUMN` as SQLite does
not support it.
- If there is only 1 column, or all columns are present in indexes, do
not generate a `DROP COLUMN` as it would be an error in the database
- if there are no tables, obviously do not generate `ALTER TABLE`
Some fixes:
- handle NULL generation in `GTValue` and `LTValue`, as we now have to
handle nulls due to `ADD COLUMN` adding cols with NULL
- correctly compare NULLs in `binary_compare`

Closes #3650
2025-10-13 14:16:49 +03:00
Jussi Saurio
2baea154b0 clippy 2025-10-13 14:11:18 +03:00
Jussi Saurio
3669437482 Add vibecoded tests for ColumnUsedMask 2025-10-13 14:03:34 +03:00
Jussi Saurio
e055ed9a8d Allow arbitrarily many columns in a table
Use roaring bitmaps because ColumnUsedMask is likely to be
sparsely populated.
2025-10-13 13:30:26 +03:00
Jussi Saurio
59a1c2ae2e Disallow joining more than 63 tables
Returns an error instead of panicing
2025-10-13 13:30:03 +03:00
Pekka Enberg
bd97c117ed whopper: Remove debug printouts 2025-10-13 12:19:09 +03:00
Pekka Enberg
77492641db Merge 'Move all checksum tests behind the feature flag' from Avinash Sajjanshetty
Closes #3704
2025-10-13 11:46:56 +03:00
Avinash Sajjanshetty
4a29694475 rename checksums tests appropriately 2025-10-13 13:48:07 +05:30
Avinash Sajjanshetty
ee479d2e52 Move all checksum tests behind the feature flag 2025-10-13 13:47:25 +05:30
Pekka Enberg
9e7c1e9061 Merge 'core/vdbe: Improve IdxDelete error messages with context' from Pekka Enberg
We currently return the exact same error from two different IdxDelete
paths. Improve the messages with context about what we're doing to make
this error more debuggable.

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

Closes #3699
2025-10-13 10:19:08 +03:00
Pekka Enberg
9eeefa27e9 Merge 'stress: Add busy timeout support with 5 second default' from Pekka Enberg
Add `--busy-timeout` command-line option to turso-stress with a default
value of 5000 ms. This helps prevent spurious database busy errors
during concurrent stress testing and ensure that integrity checks are
not skipped because of concurrent writes.

Closes #3696
2025-10-13 10:19:01 +03:00
Pekka Enberg
49bf81ab8b Merge 'Add WINDOW functions to COMPAT.md' from Jussi Saurio
Closes #3701
2025-10-13 10:18:54 +03:00
Jussi Saurio
171bcd83ec COMPAT.MD: note about WINDOW functions 2025-10-13 10:16:13 +03:00