Commit Graph

102 Commits

Author SHA1 Message Date
Pekka Enberg
2fc5c0ce5c Switch to runtime flag for enabling indexes
Makes it easier to test the feature:

```
$ cargo run --  --experimental-indexes
Limbo v0.0.22
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database
limbo> CREATE TABLE t(x);
limbo> CREATE INDEX t_idx ON t(x);
limbo> DROP INDEX t_idx;
```
2025-06-26 10:07:28 +03:00
Jussi Saurio
9aae1ff00a sim: add Fault::ReopenDatabase
Add fault type that reopens the DB and reconnects the connections.
It purposefully does not call conn.close(), as the default behavior
of that method is to checkpoint the database.

This easily exposes multiple manifestations of DB/WAL corruption caused by
this issue: https://github.com/tursodatabase/limbo/issues/1725

in fact, in my testing, every run fails when this fault is enabled. Hence I've
added the --disable-reopen-database flag if you want to try to find some other
bugs.
2025-06-24 14:41:50 -03:00
Nils Koch
2827b86917 chore: fix clippy warnings 2025-06-23 19:52:13 +01:00
Pekka Enberg
90c1e3fc06 Switch Connection to use Arc instead of Rc
Connection needs to be Arc so that bindings can wrap it with `Mutex` for
multi-threading.
2025-06-16 10:43:19 +03:00
pedrocarlo
83d72db901 better error messages + cleaner printing of file stats + tracing
instrumentation in `execute_interaction`
2025-06-11 11:32:45 -03:00
pedrocarlo
e19fa9f951 add additional cli options to disable other properties 2025-06-11 11:32:45 -03:00
pedrocarlo
edc1c6fbc6 force predicate in SelectSelectOptimizer to evaluate to a boolean value 2025-06-11 11:32:45 -03:00
pedrocarlo
b2fd5b9cd1 change CompoundPredicate to generate a true_clause for a single row and not for column_values + tests 2025-06-11 11:32:45 -03:00
pedrocarlo
39b57552fd unary tests 2025-06-11 11:32:45 -03:00
pedrocarlo
9f601ccb18 add cli option to disable select optimizer 2025-06-11 11:32:45 -03:00
pedrocarlo
c82f4fa0bb adjust creation of columns to avoid name collision 2025-06-11 11:32:18 -03:00
pedrocarlo
1410aaa0be mostly fix binary predicate generation 2025-06-11 11:32:18 -03:00
pedrocarlo
b60037255b small fix to binary true predicate + fuzz test for true_binary_predicate. More tests to come 2025-06-11 11:32:18 -03:00
pedrocarlo
6b58c4a33f migrate to using limbo_core::Value inside Simulator 2025-06-11 11:32:18 -03:00
pedrocarlo
2424b1b1c9 add unary to expr_to_value 2025-06-11 11:32:18 -03:00
pedrocarlo
dc901a019c implement true_unary + false_unary 2025-06-11 11:32:18 -03:00
pedrocarlo
176ec3b0ea adjustments to binary functions + backtrack return Option<T> + start of unary Predicate 2025-06-11 11:32:18 -03:00
pedrocarlo
c12fc23516 extract logic for binary generation outside of predicate.rs 2025-06-11 11:32:18 -03:00
pedrocarlo
7385ac96ec clippy 2025-06-11 11:32:18 -03:00
pedrocarlo
5a1bacc760 adjust generation for ast::Expr 2025-06-11 11:32:17 -03:00
pedrocarlo
62e7b1f64c fix generation for string literal in a different place + simplify test assertion 2025-06-11 11:32:17 -03:00
pedrocarlo
470093ca03 fix generation for string literal 2025-06-11 11:32:17 -03:00
pedrocarlo
fac4b4e6fb fix generation and expr evaluation 2025-06-11 11:32:17 -03:00
pedrocarlo
9f2608bded remove previous predicate struct and rewrite generation with the new the struct 2025-06-11 11:32:17 -03:00
pedrocarlo
3e369b9dde drop in replacement for predicate that uses ast::Expr under the hood 2025-06-11 11:32:17 -03:00
pedrocarlo
f1146e716c inital implementation for ast generation 2025-06-11 11:32:06 -03:00
pedrocarlo
63cf648e2e filter for the tables that the failing query depended on + second pass after query clear 2025-06-11 02:52:26 -03:00
Jussi Saurio
5680326881 sim: add CREATE INDEX to interactions 2025-06-04 09:21:59 +03:00
pedrocarlo
1c424818aa simulator options to disable certain query types 2025-06-03 22:21:40 -03:00
Pere Diaz Bou
1ca67d0092 remove dumb log 2025-05-30 11:03:09 +02:00
Pere Diaz Bou
d3495238c4 set default level info and log seed at startup 2025-05-30 11:02:05 +02:00
Pere Diaz Bou
8ec7e616b4 simulator: switch to tracing, run io.run_once and add update queries
* Without tracing crate we cannot log anything that happens in
limbo_core
* IO never ran in step loop inside simulator.
* Added update queries (which currently loop forever for some reason I'm
debugging).
2025-05-30 10:57:13 +02:00
Pekka Enberg
e3f71259d8 Rename OwnedValue -> Value
We have not had enough merge conflicts for a while so let's do a
tree-wide rename.
2025-05-15 09:59:46 +03:00
alpaylan
d4707fe391 add non-zero exit code in case of failures, remove the interactive initalization option in bug base for now, fix bugs in differential mode, add detailed information regarding runs to the bug base 2025-04-11 11:23:03 -04:00
alpaylan
64c2917e81 add bug base, refactor 2025-04-08 17:48:16 -04:00
Pere Diaz Bou
9291f60722 Introduce Register struct
OwnedValue has become a powerhouse of madness, mainly because I decided
to do it like that when I first introduced AggContext. I decided it was
enough and I introduced a `Register` struct that contains `OwnedValue`,
`Record` and `Aggregation`, this way we don't use `OwnedValue` for
everything make everyone's life harder.

This is the next step towards making ImmutableRecords the default
because I want to remove unnecessary allocations. Right now we clone
OwnedValues when we generate a record more than needed.
2025-03-27 17:53:02 +01:00
Pekka Enberg
936ae307b7 core: Kill value type
We currently have two value types, `Value` and `OwnedValue`. The
original thinking was that `Value` is external type and `OwnedValue` is
internal type. However, this just results in unnecessary transformation
between the types as data crosses the Limbo library boundary.

Let's just follow SQLite here and consolidate on a single value type
(where `sqlite3_value` is just an alias for the internal `Mem` type).
The way this will eventually work is that we can have bunch of
pre-allocated `OwnedValue` objects in `ProgramState` and basically
return a reference to them all the way to the application itself, which
extracts the actual value.
2025-02-26 10:57:45 +02:00
alpaylan
c133bbdd29 add differential testing against rusqlite 2025-02-11 14:13:14 -05:00
Pekka Enberg
ebceefacde Merge 'simulator: add NoREC testing property' from Alperen Keleş
NoREC is a correctness property for testing optimizers, proposed by
Rigger and Su in [Detecting Optimization Bugs in Database Engines via
Non-Optimizing Reference Engine
Construction](https://www.manuelrigger.at/preprints/NoREC.pdf)
This PR adds a NoREC property to the tester.

Closes #973
2025-02-11 17:44:56 +02:00
Pekka Enberg
4c064790b2 Merge 'simulator: add DROP TABLE <t> support' from Alperen Keleş
I wanted to assist the current development in an up-to-date fashion,
this PR adds drop table(which is being implemented currently in
https://github.com/tursodatabase/limbo/pull/897) testing support to the
generator.
Unfortunately, we don't have feature flags in the simulator yet, so the
users should manually fix the generation probability in
`simulator/generation/plan.rs#L644` and
`simulator/generation/property.rs#L629`.

Closes #949
2025-02-11 17:44:49 +02:00
alpaylan
747b6d15e3 add NoREC optimizer testing property 2025-02-10 15:42:49 -05:00
Tiago Ribeiro
7867e54110 Update simulator to use the new retrieval methods to access Record values. 2025-02-10 00:27:51 -07:00
Aarni Koskela
eaea02c567 Fix a handful of typos 2025-02-09 18:08:29 +02:00
alpaylan
6f567bd2ef fix formatting 2025-02-09 09:34:32 -05:00
alpaylan
47420db16f - implement DROP TABLE support, toggled off from generation for now
- clean up the query generation/printing by separating it into different files and removing duplications
2025-02-09 09:28:33 -05:00
alpaylan
7ddbcf07af fix formatting 2025-02-08 15:41:57 -05:00
alpaylan
69d72da837 fix the diff computing algorithm 2025-02-08 12:53:25 -05:00
alpaylan
3ae3e650ae fix watch mode bug deleting the last interaction of a property 2025-02-08 10:59:46 -05:00
alpaylan
966c807a64 add delete select property 2025-02-07 08:58:02 -05:00
alpaylan
9c339cb8e1 wip: add delete support to the simulator 2025-02-07 08:19:00 -05:00