Commit Graph

144 Commits

Author SHA1 Message Date
meteorgan
744df6eedf fix some typo 2025-02-13 23:03:41 +08:00
alpaylan
babf33bafa fix formatting 2025-02-11 14:15:00 -05: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
Pekka Enberg
0638550be7 Merge 'Remove unnecessary reference counting from completion I/O callbacks' from Preston Thorpe
I am on a bit of a mission to revisit a lot of the ref counting, this
was an easy first win.
It seems to be a linear path of function calls or hashmaps which can own
the completions directly, no cloning needed.

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

Closes #912
2025-02-10 12:11:30 +02: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
4362bc16a3 fix formatting 2025-02-08 09:37:08 -05:00
alpaylan
6308ce4544 fix the shrinking file and poison errors 2025-02-08 09:34:51 -05:00
PThorpe92
75898027a0 Remove unnecessary reference counting from completion io callbacks 2025-02-08 08:20:19 -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
Pekka Enberg
808ae4e7bf Merge 'simulator: add more properties and make the generated queries more complex' from Alperen Keleş
We have been working with a very small subset of SQL so far. As a rather
lightweight next phase, I propose that we make the generated queries
more realistic, slowly converging into the type definitions in
`limbo/core`. This PR will gradually implement such advances, the first
commit demonstrates how `LIMIT` is added to `SELECT`.

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

Closes #793
2025-02-07 13:40:23 +02:00
Pekka Enberg
c210821100 core: Move result row to ProgramState
Move result row to `ProgramState` to mimic what SQLite does where `Vdbe`
struct has a `pResultRow` member. This makes it easier to deal with result
lifetime, but more importantly, eventually lazily parse values at the edges of
the API.
2025-02-06 11:52:26 +02:00
alpaylan
f8905d1bc0 fix formatting 2025-02-05 11:25:58 -05:00
alpaylan
3adad219bd Merge branch 'main' of https://github.com/tursodatabase/limbo 2025-02-05 11:24:42 -05:00
alpaylan
1b3d2004cc change a potentially bug-hiding 'unwrap_or' call into 'expect' for clear messaging 2025-02-03 09:57:04 -05:00
alpaylan
8490184644 add LIKE generation for supporting clauses 2025-02-01 12:34:31 -05:00
alpaylan
48d091e112 add insert into <table> <select> generation 2025-02-01 10:40:07 -05:00
sonhmai
d4e5f83932 add references for dst 2025-01-28 11:32:17 +07:00
alpaylan
f5139f086e add select-limit property 2025-01-27 01:24:20 +03:00
Pekka Enberg
7967cc5efc core: Kill Rows wrapper struct
It's just an useless wrapper, kill it.
2025-01-26 16:27:19 +02:00
Pekka Enberg
0d0906dce4 Merge 'simulator: implement --load and --watch flags' from Alperen Keleş
The current status of the PR is halfway. The new framing of simulation
runner where `setup_simulation` is separated from `run_simulation`
allows for injecting custom plans easily. The PR is currently missing
the functionality to update the `SimulatorEnv` ad hoc from the plan, as
the environment tables were typically created during the planning phase.
The next steps will be to implement a function `fn
mk_env(InteractionPlan, SimulatorEnv) -> SimulatorEnv`, add `--load`
flag to the CLI for loading a serialized plan file, making a
corresponding environment and running the simulation.
We can optionally combine this with a `--save` option, in which we keep
a seed-vault as part of limbo simulator, corresponding each seed with
its generated plan and save the time to regenerate existing seeds by
just loading them into memory. I am curious to hear thoughts on this?
Would the maintainers be open to adding such a seed-vault? Do you think
the saved time would be worth the complexity of the approach?

Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #720
2025-01-26 08:52:58 +02:00
sonhmai
75f0cf9e20 chore: make clippy happy 2025-01-20 13:29:23 +07:00
alpaylan
e476b9f697 implement watch mode
- add `--watch` flag
- start saving seeds in persistent storage
- make a separate version of execution functions that use `vector of interaction` instead of `InteractionPlan`
2025-01-18 23:54:03 +03:00
Jorge López
e5faa3273a syntactic changes: remove unused self dependency to appease to our Clippy overlord... 2025-01-18 19:36:32 +01:00
Jorge López
0d6e6a0aa4 syntactic changes: use Result::unwrap_or() instead of manual match 2025-01-18 19:20:11 +01:00
Jorge López
f160206cdd syntactic changes: replace unwrap() with ? in functions that return Result<...> 2025-01-18 18:33:43 +01:00
Jorge López
86a4714711 syntactic changes: remove unneeded paths when the type is already imported 2025-01-18 18:29:12 +01:00
alpaylan
c30e2757b4 - implement '--load <PATH>' flag that loads an interaction plan and executes it instead of generating one from scratch
- save a json serialization of the generated plans to `<tempdir>/simulator.plan.json`
2025-01-17 22:04:55 +03:00
alpaylan
28cde537a8 this commit;
- makes interaction plans serializable
- fixes the shadowing bug where non-created tables were assumed to be created in the shadow tables map
- makes small changes to make clippy happy
- reorganizes simulation running flow to remove unnecessary plan regenerations while shrinking and double checking
2025-01-17 01:30:46 +03:00
Jussi Saurio
0f4cc8f0cc Simulator: expose inner error in assertion failure, if any 2025-01-15 19:22:05 +02:00
Pekka Enberg
4fafaba607 simulator: Reduce generated sequence size defaults
...otherwise the simulator runs forever...
2025-01-15 18:32:03 +02:00
alpaylan
ea6ad8d414 remove debug print 2025-01-15 12:44:43 +03:00
alpaylan
c446e29a50 add missed updates from the merge 2025-01-15 11:42:48 +03:00
alpaylan
ecb0f782ac Merge branch 'main' of https://github.com/tursodatabase/limbo 2025-01-15 10:59:46 +03:00
Pekka Enberg
3c118db20d simulator: Welcome banner 2025-01-14 19:15:14 +02:00
Pekka Enberg
a9ffa72151 simulator: Replace println() calls with log::info() 2025-01-14 18:40:03 +02:00
Pekka Enberg
0c7ebd4df5 simulator: Enable info-level logging by default 2025-01-14 17:54:39 +02:00
Pekka Enberg
30a380cab1 simulator: Move more logging under trace level 2025-01-14 17:54:29 +02:00
Pekka Enberg
3c6c6041ff simulator: Log query errors with debug level
...it is totally fine for a SQL query to fail as part of the simulation.
For example, if we attempt to create a table that already exists, the
expectation is that the query fails. No need to spam the logs.
2025-01-14 17:41:07 +02:00
Pekka Enberg
e1f5fa875e simulator: Make simulator runs longer by default 2025-01-14 17:37:53 +02:00
Pekka Enberg
14ec057a34 simulator: Make stats printout prettier
```
op           calls   faults
--------- -------- --------
pread            3        0
pwrite           1        0
sync             0        0
--------- -------- --------
total            4        0
```
2025-01-14 17:32:31 +02:00