Commit Graph

9992 Commits

Author SHA1 Message Date
pedrocarlo
4fc7be5042 as we have DROP table now, if we want to generate extensional queries eagerly, without affecting how we document interactions with MVCC, we need to travel forward in time and shadow queries eagerly so we can generate queries correctly. This involves cloning the tables unfortunately which is inneficient but correct 2025-10-07 11:38:47 -03:00
pedrocarlo
3e8867c8f5 DropSelect property should only fail when error is not a parse error on the table name 2025-10-07 11:38:47 -03:00
pedrocarlo
7f93f64fc5 enable Drop statements 2025-10-07 11:38:47 -03:00
Pekka Enberg
ff67c1f3ca Merge 'Make table name not repeat in simulator' from bit-aloo
closes: #3254

Closes #3617
2025-10-07 17:04:23 +03:00
Pekka Enberg
243a5c719f Merge 'Fix re-entrancy of op_destroy (used by DROP TABLE)' from Jussi Saurio
op_destroy was assuming we never yield IO from
BTreeCursor::btree_destroy(), so every so often it would just not
complete the procedure and leave dangling pages in the database
Closes #3608

Closes #3618
2025-10-07 16:13:23 +03:00
bit-aloo
7f8c139638 make clippy happy 2025-10-07 18:27:02 +05:30
Jussi Saurio
5583e76981 Fix re-entrancy of op_destroy (used by DROP TABLE)
op_destroy was assuming we never yield IO from BTreeCursor::btree_destroy(),
so every so often it would just not complete the procedure and leave
dangling pages in the database
2025-10-07 15:38:30 +03:00
bit-aloo
73efe5d853 make table name not repeat in simulator 2025-10-07 17:49:15 +05:30
Pekka Enberg
fc2d532d80 Merge 'perf/throughput: Delete database before benchmark run' from Pekka Enberg
Let's reduce variance between benchmark runs by starting with an empty
database.

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

Closes #3610
2025-10-07 13:44:34 +03:00
Pekka Enberg
1dbf493f14 Merge 'emit proper column information for explain prepared statements' from Nikita Sivukhin
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #3612
2025-10-07 13:44:17 +03:00
Pekka Enberg
b98c4ece0d Merge 'core/mvcc/logical-log: switch RwLock to parking_lot' from Pere Diaz Bou
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #3615
2025-10-07 13:43:39 +03:00
Pekka Enberg
c3dbcec8c9 Merge 'core/io: remove new_dummy in place of new_yield' from Pere Diaz Bou
Yield is a completion that does not allocate any inner state. By design
it is completed from the start and has no errors. This allows lightly
yield without allocating any locks nor heap allocate inner state.

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

Closes #3616
2025-10-07 13:39:19 +03:00
Pere Diaz Bou
a7d2462c05 core/io/uring: fix inner usages
Yield is a completion that does not allocate any inner state. By design
it is completed from the start and has no errors. This allows lightly
yield without allocating any locks nor heap allocate inner state.
2025-10-07 12:05:54 +02:00
Pere Diaz Bou
3e508a4b42 core/io: remove new_dummy in place of new_yield
Yield is a completion that does not allocate any inner state. By design
it is completed from the start and has no errors. This allows lightly
yield without allocating any locks nor heap allocate inner state.
2025-10-07 12:00:33 +02:00
Pere Diaz Bou
44152f11d0 core/mvcc/logical-log: switch RwLock to parking_lot 2025-10-07 11:15:48 +02:00
Nikita Sivukhin
bd1013d62f emit proper column information for explain prepared statements 2025-10-07 12:28:55 +04:00
Pekka Enberg
d5c49c17c7 perf/throughput: Delete database before benchmark run
Let's reduce variance between benchmark runs by starting with an empty
database.
2025-10-07 09:57:08 +03:00
Jussi Saurio
f78103cafa Merge 'Modify Interactions Generation to only generate possible queries' from Pedro Muniz
I simplified `Interactions` generation code to first check the possible
queries we can generate and then create a Weighted Distribution to
generate `Query` and `Property`. This change allows us to not generate
certain types of queries if we have no tables, as it is not sound for
the Simulator to generate an `Update` query if there are no tables in
the database. I made this change for correctness and because I want to
introduce schema changes to the simulator and this is necessary.
Also, there is the additional benefit of us allocating less memory,
doing static function dispatch instead of creating closures all the time
for generation, and the code, in my opinion, being more readable.

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>
Reviewed-by: bit-aloo (@Shourya742)

Closes #3585
2025-10-07 09:36:10 +03:00
Pekka Enberg
a72b07e949 Merge 'Fix VDBE program abort' from Nikita Sivukhin
This PR add proper program abort in case of unfinished statement reset
and interruption.
Also, this PR makes rollback methods non-failing because otherwise of
their callers usually unclear (if rollback failed - what is the state of
statement/connection/transaction?)

Reviewed-by: Preston Thorpe <preston@turso.tech>

Closes #3591
2025-10-07 09:07:07 +03:00
Pekka Enberg
dacb8e3350 Merge 'Fix attach I/O error with in-memory databases' from Preston Thorpe
closes #3540

Closes #3602
2025-10-07 09:00:02 +03:00
Pekka Enberg
ce41bebaa8 Merge 'core/incremental: Fix re-insertion of data with same key' from Glauber Costa
There is currently a bug found in our materialized view implementation
that happens when we delete a row, and then re-insert another row with
the same primary key.
Our insert code needs to detect updates and generate a DELETE + INSERT.
But in this case, after the initial DELETE, the fresh insert generates
another delete.
We ended up with the wrong response for aggregations (and I am pretty
sure even filter-only views would manifest the bug as well), where
groups that should still be present just disappeared because of the
extra delete.
A new test case is added that fails without the fix.

Closes #3601
2025-10-07 08:47:38 +03:00
Pekka Enberg
e9be38c769 Merge 'Add MVCC checkpoint threshold pragma' from bit-aloo
closes: #3575

Closes #3604
2025-10-07 08:46:41 +03:00
Pekka Enberg
5f2beb1122 Merge 'core/incremental: Implement "is null" and "is not null" tests for view filter' from Glauber Costa
Just overlook on our side that they were not generated before.

Closes #3603
2025-10-07 08:45:45 +03:00
pedrocarlo
8b6456f843 do not allow Property::Queries to attempt to be generated 2025-10-07 02:36:14 -03:00
pedrocarlo
91da12390d refactor property generation to use query distribution and avoid more
memory allocations
2025-10-07 02:36:14 -03:00
pedrocarlo
b1c26505b8 adjust Rng generic to include ?Sized + introduce WeightedDistribution trait 2025-10-07 02:36:13 -03:00
pedrocarlo
aec6668725 add ?Sized to Arbitrary traits 2025-10-07 02:36:13 -03:00
pedrocarlo
a5845285be remove unnecessary functions 2025-10-07 02:36:13 -03:00
pedrocarlo
bb9c8dea4f rework interaction generation to only generate possible queries + do less allocations 2025-10-07 02:36:13 -03:00
pedrocarlo
1d1b09dc17 modify query generation to always sample from valid queries 2025-10-07 02:36:13 -03:00
bit-aloo
afadb32c4c fmt fixes 2025-10-07 10:20:13 +05:30
bit-aloo
68b6ffe57c Implement mvcc_checkpoint_threshold pragma 2025-10-07 10:17:05 +05:30
bit-aloo
551dbf518e Add new mvcc_checkpoint_threshold pragma name 2025-10-07 10:17:05 +05:30
bit-aloo
fb5f5d9a90 Add MVCC checkpoint threshold APIs to Connection 2025-10-07 10:17:04 +05:30
bit-aloo
66c69461fb Add getter/setter for checkpoint threshold in LogicalLog
Wire threshold access through Storage

Add checkpoint threshold accessors to MvStore
2025-10-07 10:17:04 +05:30
Glauber Costa
e2694ff88b implement is null / is not null tests for mview filter
Just overlook on our side that they were not generated before.
2025-10-06 21:22:30 -05:00
PThorpe92
20d2ca55fe fix clippy warning 2025-10-06 21:43:48 -04:00
PThorpe92
addb9ef65b Add regression test for #3540 attach issue 2025-10-06 21:33:42 -04:00
PThorpe92
17da71ee3c Open db with proper IO when attaching database to fix #3540 2025-10-06 21:33:20 -04:00
Glauber Costa
beb44e8e8c fix mviews with re-insertion of data with the same key
There is currently a bug found in our materialized view implementation
that happens when we delete a row, and then re-insert another row with
the same primary key.

Our insert code needs to detect updates and generate a DELETE +
INSERT. But in this case, after the initial DELETE, the fresh insert
generates another delete.

We ended up with the wrong response for aggregations (and I am pretty
sure even filter-only views would manifest the bug as well), where
groups that should still be present just disappeared because of the
extra delete.

A new test case is added that fails without the fix.
2025-10-06 20:12:49 -05:00
Preston Thorpe
497808a40c Merge 'eliminate the need for another Once in Completion' from Pedro Muniz
I added the `Once` before so fix a bug, but it was a bit hackery. We can
`get_or_init` to achieve the same purpose, and the code becomes much
cleaner. `get_or_init` guarantees the init will happen only once as
well.

Reviewed-by: Preston Thorpe <preston@turso.tech>
Reviewed-by: bit-aloo (@Shourya742)

Closes #3578
2025-10-06 19:52:41 -04:00
Pekka Enberg
f8bdc02986 Merge 'Rename Completion methods' from Pedro Muniz
Reviewed-by: bit-aloo (@Shourya742)
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #3579
2025-10-06 20:12:21 +03:00
Pekka Enberg
0134192cae Merge 'Top level examples' from Nikita Sivukhin
Closes #3599
2025-10-06 18:26:18 +03:00
Pere Diaz Bou
59c08c1062 Merge 'core/mvcc: implement PartialOrd for RowId' from Pere Diaz Bou
Closes #3597
2025-10-06 16:42:04 +02:00
Nikita Sivukhin
d2dab3d18c fix main workspace dir 2025-10-06 18:30:29 +04:00
Nikita Sivukhin
f0c7cff18c add README 2025-10-06 18:19:22 +04:00
pedrocarlo
2ce0e9db57 eliminate the need for another Once in Completion 2025-10-06 11:10:41 -03:00
pedrocarlo
5a7390735d rename Completion functions 2025-10-06 11:07:06 -03:00
Nikita Sivukhin
926fd25cdd move examples to the top-level directory 2025-10-06 18:01:54 +04:00
Nikita Sivukhin
e2f7310617 add explicit tracker for Txn cleanup necessary for statement 2025-10-06 17:51:43 +04:00