Commit Graph

89 Commits

Author SHA1 Message Date
alpaylan
82fcc27a58 this commit fixes query generation;
- previous query generation method was faulty, producing wrong assertions
- this commit adds a new arbitrary_from implementation for predicates
- new implementation takes a table and a row, and produces a predicate that would evaluate to true for the row
this commit makes small changes to the main for increasing readability
2025-01-13 02:31:19 +03:00
alpaylan
191b586f05 this commit restructures the interaction generation in order to have
better counterexample minimization.

- it separates interaction plans from their state of execution
- it removes closures from the property definitions, encoding properties as an enum variant, and deriving the closures from the variants.
- it adds some naive counterexample minimization capabilities to the Limbo simulator and reduces the plan sizes considerably.
- it makes small changes to various points of the simulator for better error reporting, enhancing code readability, small fixes to handle previously missed cases
2025-01-11 02:20:22 +03:00
alpaylan
cc56276c3a add execution history to the simulator, the history records
three indexes(connection, interaction pointer, and secondary pointer)
that can uniquely identify the executed interaction at any point.
we will use the history for shrinking purposes.
2025-01-07 13:40:29 +03:00
alpaylan
daa77feea1 add assumptions to the interactions, where a failing assumption stops
the execution of the current property and switches to the next one.
2025-01-06 19:04:29 +03:00
alpaylan
2a4d461627 previously, interactions plans were comprised of a flat sequence of operations that
did not reflect the internal structure, in which they were actually concatenations of
properties, which are a coherent set of interactions that are meaningful by themselves.
this commit introduces this semantic layer into the data model by turning interaction plans
into a sequence of properties, which are a sequence of interactions
2025-01-06 18:16:34 +03:00
alpaylan
d8ce88c057 fix clippy warning 2024-12-30 00:41:21 -05:00
alpaylan
58f23983e1 minor changes, add maximum time bound to the simulator, fix bug in the table create shadowing 2024-12-30 00:36:43 -05:00
alpaylan
c01f2d4ac2 fix formatting 2024-12-29 16:09:49 -05:00
alpaylan
8e2a1e4289 Merge remote-tracking branch 'turso/main' 2024-12-29 16:08:35 -05:00
alpaylan
d3fee3b331 add empty line at the end of cargo.toml, add create counts to the interaction stats, turn the percentages into f64 2024-12-29 14:00:57 -05:00
PThorpe92
f6cd707544 Add clippy CI, fix or ignore warnings where appropriate 2024-12-29 10:25:41 -05:00
adamnemecek
97647ff056 Clean up code to use Self
Closes #556
2024-12-29 10:07:38 +02:00
Pekka Enberg
f2ecebc357 Rename RowResult to StepResult
The name "row result" is confusing because it really *is* a result from
a step() call. The only difference is how a row is represented as we
return from VDBE or from a statement.

Therefore, rename RowResult to StepResult.
2024-12-27 10:20:41 +02:00
alpaylan
ad0288b39c fix formatting 2024-12-26 15:23:10 -05:00
alpaylan
12fee4df37 remove the regex dependency as functionality is possible without it 2024-12-26 15:20:19 -05:00
Alperen Keleş
7524cf052e Merge branch 'tursodatabase:main' into main 2024-12-26 15:10:40 -05:00
alpaylan
003ad6cc64 allow failure assertions in the simulator, add creating the same table two times to the list of checked properties as a failure property example 2024-12-26 15:10:03 -05:00
jussisaurio
fa5ca68eec Add multi-row insert to simulator 2024-12-25 21:14:55 +02:00
Pekka Enberg
548f66e1cd Merge 'fix empty range error when 0 interactions are produced by creating at least 1 interaction' from Alperen Keleş
Fixes the panicking case in
https://github.com/tursodatabase/limbo/issues/548

Closes #549
2024-12-25 19:45:09 +02:00
alpaylan
e49ba4f982 fix empty range error when 0 interactions are produced by creating at least 1 interaction 2024-12-25 09:55:28 -05:00
Pekka Enberg
652283efc1 simulator: Kill dead code
...the old maybe_add_table() codepath as it is not used.
2024-12-25 10:41:05 +02:00
alpaylan
28ae691bf7 switch the seed, database path, and plan path prints to println instead of log::info 2024-12-25 03:04:57 -05:00
Pekka Enberg
49b235cc92 Merge 'core: wal transaction start' from Pere Diaz Bou
This pr adds support for multiple readers and a single writer with a
custom made lock called `LimboRwLock`. Basically there are 5 allowed
read locks which store the max frame allowed in that "snapshot" and any
reader will try to acquire the biggest one possible. Writer will just
try to lock the `write_lock` and if not successful, it will return busy.
The only checkpoint mode supported for now is `PASSIVE` but it should be
trivial to add more modes.
This needs testing, but I will do it in another PR. I just wanted to do
it in another PR.

Closes #544
2024-12-25 09:42:03 +02:00
Pere Diaz Bou
aed14117c9 core: transaction support 2024-12-24 18:04:30 +01:00
alpaylan
2186b3973b change the name of the simulator submodule into runner 2024-12-23 16:16:39 -05:00
alpaylan
4f07342fdc catch panics, add doublecheck 2024-12-22 23:25:35 -05:00
alpaylan
833c75080b break up the simulator primitives into their own files in the simulator submodule 2024-12-22 17:16:50 -05:00
alpaylan
9f08b621ec add clap CLI for configuring the simulator 2024-12-22 17:06:46 -05:00
Pekka Enberg
13f229020e simulator: Use "mod.rs" for module top-level files
Let's use "mod.rs" for the module top-level file as we do in the rest of
the Limbo codebase for consistency.
2024-12-21 09:50:23 +02:00
alpaylan
8f8b97d54b add the missing rowresult variant 2024-12-20 12:27:54 -05:00
alpaylan
d2723b777b update table create probability, print interactions as info logs 2024-12-20 12:18:03 -05:00
Alperen Keleş
54c3423fec Merge branch 'tursodatabase:main' into main 2024-12-20 12:17:10 -05:00
alpaylan
b355568023 use ticks as the main simulator driver, handle disconnects correctly, add multi-connection setup 2024-12-19 23:40:04 -05:00
Pekka Enberg
e93ac38e55 Add statement interruption support
This adds an interrupt() method to Statement that allows apps to
interrupt a running statement. Please note that this is different from
`sqlite3_interrupt()` which interrupts all ongoing operations in a
database. Although we want to support that too, per statement interrupt
is much more useful to apps.
2024-12-19 12:30:32 +02:00
alpaylan
cb20ca7e40 fix formatting 2024-12-18 17:10:18 -05:00
alpaylan
39b5dbed55 change gen.range based queries into frequency and one_of calls 2024-12-18 17:09:44 -05:00
alpaylan
66e7a4edec fix formatting 2024-12-17 18:30:55 -05:00
alpaylan
7d4d803a13 implement interaction plans 2024-12-17 18:24:39 -05:00
alpaylan
53ecedaceb fix formatting 2024-12-16 10:49:56 -05:00
alpaylan
be18c6e8f0 break simulator into parts, add readme 2024-12-16 10:49:05 -05:00
alpaylan
0172c512ac fix formatting 2024-12-15 12:51:01 -05:00
alpaylan
ec1c796650 change the boolean name to a more descriptive version 2024-12-15 12:50:38 -05:00
alpaylan
8e094de6aa fix random character generation 2024-12-14 14:57:32 -05:00
alpaylan
a1b2ab3f54 change names to more descriptive versions, fix the equal row comparison to check the ordering 2024-12-14 14:46:22 -05:00
alpaylan
31fcdb8727 add workload percentage back to the simulator, fix the smaller/larger UTF8 string generator 2024-12-14 14:46:22 -05:00
Alperen Keleş
5284603c6e Merge branch 'tursodatabase:main' into main 2024-12-14 14:46:12 -05:00
alpaylan
8cb7086bfc formatting changes 2024-12-13 16:08:50 -05:00
alpaylan
ab556032f5 change the names of guard to predicate, arbitrary_of to arbitrary_from, ArbitraryOf to ArbitraryFrom 2024-12-13 16:07:56 -05:00
alpaylan
2d712d2b35 update simulator to randomly pick an action and check its postconditions 2024-12-13 15:59:16 -05:00
alpaylan
6029fc6303 fix formatting errors 2024-12-13 07:56:41 -05:00