Commit Graph

161 Commits

Author SHA1 Message Date
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
Diego Reis
d9bf383507 core/io: Untie MemoryIO's lifetime of the IO layer 2025-04-13 11:10:06 -03:00
Diego Reis
79f8b83cbe Fix dumb clippy errors 2025-04-13 11:10:06 -03:00
alpaylan
e13b5bc698 fix min/max-tests bug 2025-04-11 15:33:32 -04:00
alpaylan
9d08693e8f add simulator subcommands 2025-04-11 14:10:12 -04: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
d96906ebc3 update simulator readme 2025-04-09 14:02:58 -04:00
alpaylan
64c2917e81 add bug base, refactor 2025-04-08 17:48:16 -04:00
Avinash Sajjanshetty
3543e83b91 Impl Clock trait in bindings 2025-04-06 23:34:15 +05:30
Pekka Enberg
8caa234df3 simulator: Reduce info-level logging
Make the simulator less noisy for casual runs.
2025-03-28 08:10:57 +02: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
Pere Diaz Bou
004dc374b2 bump rusqlite to 0.34 2025-03-25 14:17:31 +01:00
pedrocarlo
ffc2e12a83 lock anarchist generator dependecy to 0.12 2025-03-06 15:52:20 -03:00
Pekka Enberg
96175cccf7 cli: Add --experimental-mvcc option to enable MVCC 2025-03-06 10:16:42 +02:00
Pere Diaz Bou
8daf7666d1 Make database Sync + Send 2025-03-05 14:07:48 +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
39b11812ea bump rusqlite to 0.33.0 from 0.29.0 2025-02-18 15:13:15 -05:00
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