508 Commits

Author SHA1 Message Date
pedrocarlo
c2be60b007 add pragma to shrinking 2025-11-17 11:45:02 -03:00
pedrocarlo
f09b73c768 remove Span, as interaction ID is enough to determine membership of a property 2025-11-17 11:45:02 -03:00
pedrocarlo
2aab33b714 find_interactions_range only check for interaction id to determine membership 2025-11-17 11:45:02 -03:00
pedrocarlo
4fd0896538 remove extension queries from other types of properties 2025-11-17 11:45:02 -03:00
pedrocarlo
9d439556ca if table changed names, add its previous names to depending tables when shrinking 2025-11-17 11:45:02 -03:00
pedrocarlo
af31e74d9f add depending tables to assertions to delete them if needed in shrinking 2025-11-17 11:45:02 -03:00
pedrocarlo
087d5f59a1 fix execution ticks not ticking enough 2025-11-17 11:45:02 -03:00
pedrocarlo
836d115853 create interaction plan correct in main.rs 2025-11-17 11:45:02 -03:00
pedrocarlo
2c8754985b refactor shrinking to use utilities in the InteractionPlan to iterate over properties, instead of handrolling property iteration 2025-11-17 11:45:02 -03:00
pedrocarlo
a21f7675dd - update interaction stats on demand instead of reading the entire plan
to calculate metrics per generation step 
- simplify generation as we now only store `Interaction`. So now we can 
  funnel most of the logic for interaction generation, metric update,
  and Interaction append in the `PlanGenerator::next`.
2025-11-17 11:45:02 -03:00
pedrocarlo
157a5cf10a - add Interaction Builder to simplify code for building an interaction.
Modify `generation/property.rs` to use the Builder
- add additional metadata to `Interaction` to give more context for
  shrinking and iterating over interactions that originated from the
  same interaction.
- add Iterator like utilities for `InteractionPlan` to facilitate
  iterating over interactions that came from the same property:
2025-11-17 11:45:02 -03:00
pedrocarlo
c088a653e6 move interaction stats to metrics 2025-11-17 11:45:02 -03:00
pedrocarlo
2fe39d40bb add Span and PropertyMetadata structs 2025-11-17 11:45:02 -03:00
pedrocarlo
a4f0f2364d disable Watch Mode until we can properly serialize interaction plan 2025-11-17 11:45:02 -03:00
pedrocarlo
4f143f385a - modify bugbase to not save interaction plan in a plan.json. As we
will track `Interaction` instead of `Interactions` in the Plan, this
  change will impossibilitate the serialization of the InteractionPlan with Serde Json. 
- make --load just load the previous cli args
2025-11-17 11:45:02 -03:00
pedrocarlo
8f50154db2 separate struct defining code from struct generation code. Also move Remaining to a metrics file 2025-11-17 11:44:20 -03:00
Mikaël Francoeur
d309e6ddb3 generate self-inserts with nested subqueries 2025-11-14 09:16:17 -05:00
Mikaël Francoeur
23d6080531 make FromClause recursive 2025-11-14 09:16:17 -05:00
Mikaël Francoeur
8ea038c00b fix join 2025-11-14 09:16:17 -05:00
Pekka Enberg
913b7ac600 core: Disable autovacuum by default
People have discovered various bugs in autovacuum so let's disable it by
default for now.
2025-11-02 12:09:21 +02:00
Pavan-Nambi
cf93360b9c cleanup
Co-authored-by: Mikaël Francoeur <mikael.francoeur@hotmail.com>

cleanup

Co-authored-by: Mikaël Francoeur <mikael.francoeur@hotmail.com>
2025-10-24 19:35:13 +05:30
Pavan-Nambi
8d0ae362da Merge branch 'main' of github.com:tursodatabase/turso into avcm 2025-10-24 18:58:30 +05:30
Pavan-Nambi
dbd8b1b01d change weight and add pragma_weight to querytypes 2025-10-24 18:10:10 +05:30
pedrocarlo
72baf48863 add random generation in simulator IO 2025-10-21 14:10:38 -03:00
Jussi Saurio
b67fabdd62 Fix git directory resolution in simulator to support worktrees
sim cannot be run in a git worktree on main
2025-10-21 14:34:27 +03:00
Bob Peterson
b92f4cb9c4 Make Miri easier to run 2025-10-20 23:48:19 -05:00
Pavan-Nambi
73cabf49f2 fmt sim 2025-10-18 18:46:20 +05:30
Pavan-Nambi
b473a1c3ca Merge remote-tracking branch 'mikael/sim-pragma' into avcm 2025-10-18 16:41:39 +05:30
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
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
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
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
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
pedrocarlo
b2e54d9816 add Drop Index to simulator model 2025-10-13 13:32:16 -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
pedrocarlo
773fa28063 workaround in sqlite for schema changes become visible to other connections 2025-10-13 02:34:43 -03:00
pedrocarlo
dca1137f81 rusqlite stop trying to get rows when we error with InvalidColumnIndex 2025-10-13 02:34:43 -03:00
pedrocarlo
d99e3f590f ALTER TABLE should be added to is_ddl 2025-10-13 02:34:43 -03:00
pedrocarlo
5f65196115 fix load_bug 2025-10-13 02:34:43 -03:00
pedrocarlo
b6c5fee300 do not count certain interactions in the InteractionPlan and correctly report the length when shrinking 2025-10-13 02:34:43 -03:00
pedrocarlo
49e96afd39 generate ALTER COLUMN 2025-10-13 02:34:43 -03:00
pedrocarlo
a18a472685 add option to disable alter column for differential testing 2025-10-13 02:34:43 -03:00
pedrocarlo
703efaa724 adjust Properties to skip Alter Table in certain conditions 2025-10-13 02:34:43 -03:00
pedrocarlo
9c2edbb8b7 create separate Index struct for sql generation 2025-10-13 02:04:15 -03:00
pedrocarlo
c072058e4b add Alter Table query generation in Sim 2025-10-13 02:04:15 -03:00
pedrocarlo
230755eb2e shadow for AlterTable 2025-10-13 02:04:15 -03:00
pedrocarlo
fafbdbfa9d persist files in sim memory io for integrity check 2025-10-11 15:03:22 -03:00
pedrocarlo
f593080c2a add Query::AlterTable variant 2025-10-10 11:08:04 -03:00