Commit Graph

320 Commits

Author SHA1 Message Date
Jussi Saurio
aed48bb665 sim: reduce frequency of compound selects and complex joins 2025-08-14 19:35:16 +03:00
Jussi Saurio
1a11648974 sim: add Property::ReadYourUpdatesBack 2025-08-14 19:04:27 +03:00
Jussi Saurio
0b9d07db4c sim: restrict Update::arbitrary_from() to SET each column max once 2025-08-14 18:55:34 +03:00
Jussi Saurio
87bf488bbc chore: use rusqlite 0.37 with bundled sqlite everywhere 2025-08-11 15:13:57 +03:00
pedrocarlo
0c9ecbc768 simulator should delete files after a successful run 2025-08-09 16:25:51 -03:00
PThorpe92
f6a68cffc2 Remove RefCell from IO and Page apis 2025-08-05 16:24:49 -04:00
pedrocarlo
543cdb3e2c underscoring completions and IOResult to avoid warning messages 2025-07-31 11:51:17 -03:00
PThorpe92
daec8aeb22 impl pwritev for simulator file 2025-07-30 19:42:49 -04:00
PThorpe92
9c75872827 Make writing wal header able to be sync 2025-07-30 14:05:18 +03:00
PThorpe92
dcf346b9b0 Update apparently very old branch to new api 2025-07-30 13:48:05 +03:00
PThorpe92
52f63b2af0 Impl truncate for simulator 2025-07-30 13:48:05 +03:00
pedrocarlo
3831e0db39 convert must_use compile warnings to unused_variables to track locations where we need to refactor in the future 2025-07-28 16:09:26 -03:00
pedrocarlo
d30c7d54c8 change all Arc<Completion> to Completion 2025-07-28 15:32:45 -03:00
meteorgan
b5a18d7dc9 fix get_column_name() when column name doesn't exist 2025-07-25 23:49:31 +08:00
bit-aloo
9a54ef214e parser: Distinguish quoted identifiers and unify Id into Name enum
This commit replaces the `Name(pub String)` struct with a `Name` enum that
explicitly models how the name appeared in the source either as an
unquoted identifier (`Ident`) or a quoted string (`Quoted`).

In the process, the separate `Id` wrapper type has been coalesced into the
`Name` enum, simplifying the AST and reducing duplication in identifier
handling logic.

While this increases the size of some AST nodes (notably `yyStackEntry`),
it improves correctness and makes source structure more explicit for
later phases.
2025-07-24 14:40:19 +05:30
Jussi Saurio
e604a80e93 fix/sim: actually enable indexes by default 2025-07-21 13:35:11 +03:00
Jussi Saurio
dce355d9b7 test/stress&sim: enable indexes by default 2025-07-21 11:49:30 +03:00
Jussi Saurio
b1ebc1c82f Merge 'sim: show seed in 'execute_interaction()' trace' from Jussi Saurio
This helps e.g. when you hit some infinite loop

Closes #2161
2025-07-18 12:27:48 +03:00
Jussi Saurio
086a269a65 Merge 'sim: change --disable-create-index flag to --enable-create-index (default false)' from Jussi Saurio
Closes #2160
2025-07-18 12:27:35 +03:00
Jussi Saurio
687d126e25 sim: change --disable-create-index flag to --enable-create-index (default false) 2025-07-18 11:21:24 +03:00
Jussi Saurio
5b2d7315eb sim: show seed in 'execute_interaction()' trace 2025-07-18 11:21:04 +03:00
Jussi Saurio
d67a9f03fd sim: add order by to some queries 2025-07-18 10:47:36 +03:00
Jussi Saurio
746995f436 Merge 'Property FaultyQuery should fail if we encounter an error that is not expected' from Pedro Muniz
If we use `Assumption` here, the simulator just goes to the next
property instead of halting here.

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

Closes #2147
2025-07-17 23:44:44 +03:00
Jussi Saurio
1b52b5c764 Merge 'chore: update rust to version 1.88.0' from Nils Koch
This PR updates to version Rust 1.88.0 ([Release
notes](https://releases.rs/docs/1.88.0/)) and fixes all the clippy
errors that come with the new Rust version.
This is possible in the latest Rust version:
```rust
if let Some(foo) = bar && foo.is_cool() {
  ...
}
```
There are three complications in the migration (so far):
- A BUNCH of Clippy warnings (mostly fixed in
https://github.com/tursodatabase/limbo/pull/1827)
- Windows cross compilation failed; linking `advapi32` on windows fixes
it
  - Since Rust 1.87.0, advapi32 is not linked by default anymore
([Release notes](https://github.com/rust-
lang/rust/blob/master/RELEASES.md#compatibility-notes-1),
[PR](https://github.com/rust-lang/rust/pull/138233))
- Rust is more strict with FFIs and aligning pointers now. CI checks
failed with error below
  - Fixed in https://github.com/tursodatabase/turso/pull/2064
```
thread 'main' panicked at
core/ext/vtab_xconnect.rs:64:25:
misaligned pointer dereference: address must be
a multiple of 0x8 but is 0x7ffd9d901554
```

Closes #1807
2025-07-17 23:35:33 +03:00
pedrocarlo
4aa2c1a579 Property should fail if we encounter an error that is not expected 2025-07-17 17:01:54 -03:00
pedrocarlo
b80218324d fix merge conflicts 2025-07-17 12:25:31 -03:00
pedrocarlo
6088aa34c2 only add the sync completion after we call sync in the closure 2025-07-17 12:25:31 -03:00
pedrocarlo
0ab2f2b951 cli options for max and min tick + adjust github action to run with faster clock so no timeouts happen 2025-07-17 12:25:31 -03:00
pedrocarlo
46a7d20c12 clippy 2025-07-17 12:24:43 -03:00
pedrocarlo
4a13286d62 modify clock to use simulated time instead 2025-07-17 12:24:43 -03:00
pedrocarlo
d72a7f5d8e decrease IO latency time as Turso becomes super slow for some reason 2025-07-17 12:24:43 -03:00
pedrocarlo
7b8eec90bd edit state machine in Btree for freeing pages + Pager state machine for free_page 2025-07-17 12:24:43 -03:00
pedrocarlo
5771d1a00e disable wal sync timeout on checkpoint 2025-07-17 12:24:43 -03:00
pedrocarlo
b292e08d2b inject latency with queuing system 2025-07-17 12:24:43 -03:00
pedrocarlo
dc5f73887e refactor to require Arc<Completion> in file traits so that we can delay IO calls correctly 2025-07-17 12:24:43 -03:00
pedrocarlo
4ca5595f07 enable io latency + limit number of tests in simulator pull request CI check 2025-07-17 12:22:27 -03:00
Pekka Enberg
e8ac707190 simulator: Disable INSERT INTO .. SELECT for being slow
Refs #2129
2025-07-17 09:20:00 +03:00
Nils Koch
8dc066503e chore: fix clippy errors 2025-07-16 19:34:42 +01:00
Levy A.
89911ee8d1 remove to_sql_string from simulator 2025-07-16 12:34:10 -03:00
Levy A.
6fe2505425 add more ToTokens impls 2025-07-16 12:16:31 -03:00
Jussi Saurio
ea427b3b64 sim: provide additional context in assertion failures 2025-07-16 12:05:30 +03:00
Pekka Enberg
99d61aad3c simulator: Add mention of fsync() issue for disabled fsync faults 2025-07-16 11:15:41 +03:00
Pekka Enberg
b0971f98c2 Merge 'sim: ignore fsync faults' from Jussi Saurio
`FaultyQuery` causes frequent false positives in simulator due to the
following chain of events:
- we write rows and flush wal to disk
- inject fault during fsync which fails
- error is returned to caller, simulator thinks those rows dont exist
because the query failed
- we reopen the database i.e. read the WAL back to memory from disk, it
has those extra rows we think we didn't write
- assertion fails because table has more rows than simulator expected
More discussion about fsync behavior in issue #2091

Closes #2110
2025-07-16 11:15:23 +03:00
Jussi Saurio
bb0cad459e sim: ignore fsync faults
`FaultyQuery` causes frequent false positives in simulator due to
the following chain of events:

- we write rows and flush wal to disk
- inject fault during fsync which fails
- error is returned to caller, simulator thinks those rows dont exist because the query failed
- we reopen the database i.e. read the WAL back to memory from disk, it has those extra rows we think we didn't write
- assertion fails because table has more rows than simulator expected

More discussion about fsync behavior in issue #2091
2025-07-16 11:09:54 +03:00
Pekka Enberg
1a8bade9d5 Merge 'Updates to the simulator' from Alperen Keleş
- Add generation for UNION/JOIN
- Rearchitect the oracle calling conventions to simplify the code paths
- Add brute force shrinking option by @echoumcp1

Closes #2049
2025-07-16 11:03:41 +03:00
alpaylan
04f5b91e87 fix faulty Update generation within delete_select 2025-07-16 00:06:35 -04:00
alpaylan
28ecb083e1 fix faulty Insert::Select generation within delete_select 2025-07-15 22:35:05 -04:00
alpaylan
9347e43dfc clippy + fmt 2025-07-15 09:57:55 -04:00
alpaylan
9a921ed4b9 make the large table smaller 2025-07-15 09:56:27 -04:00
alpaylan
6b96789b6d add random_expr for SELECT <expr>; 2025-07-14 18:48:02 -04:00