Commit Graph

4188 Commits

Author SHA1 Message Date
PThorpe92
ec4bf19fc7 Gracefully handle submission queue overflow in io_uring backend 2025-08-13 12:07:41 -04:00
pedrocarlo
187ffb5698 adjust test 2025-08-13 10:24:55 +03:00
pedrocarlo
8d48be0e61 cleanup 2025-08-13 10:24:55 +03:00
pedrocarlo
fbe7e685ce adjust mvcc code to return completions in state machines 2025-08-13 10:24:55 +03:00
pedrocarlo
c1975cdfa1 ptrmap functions should bubble completions 2025-08-13 10:24:55 +03:00
pedrocarlo
b6e200dbed adjust cacheflush calls outside of pager 2025-08-13 10:24:55 +03:00
pedrocarlo
78cb61c1fe before stepping to next insntruction check for io 2025-08-13 10:24:55 +03:00
pedrocarlo
c381fe3844 bubble completions in Sorter 2025-08-13 10:24:55 +03:00
pedrocarlo
0b6ab9d969 bubble completions in execute 2025-08-13 10:24:55 +03:00
pedrocarlo
925d4b15e1 adjust more pager IO returns 2025-08-13 10:24:55 +03:00
pedrocarlo
56905fc340 refactor checkpoint in pager 2025-08-13 10:24:55 +03:00
pedrocarlo
a7f5912e7d adjust wal checkpoint to return completions 2025-08-13 10:24:55 +03:00
pedrocarlo
10ad43d9e0 sync should return completion 2025-08-13 10:24:55 +03:00
pedrocarlo
a7873d8907 remove write counters from Wal impls 2025-08-13 10:24:55 +03:00
pedrocarlo
494fdb828b buuble completions in pager 2025-08-13 10:24:55 +03:00
pedrocarlo
ccc22863c6 remove return_if_locked and return_if_locked_maybe_load 2025-08-13 10:24:55 +03:00
pedrocarlo
f95625a06c bubble completions in btree 2025-08-13 10:24:55 +03:00
pedrocarlo
82b75330bc adjust types.rs util.rs view.rs and mvcc to bubble io 2025-08-13 10:24:55 +03:00
pedrocarlo
2e68296107 create IOCompletions 2025-08-13 10:24:55 +03:00
Jussi Saurio
43628e2a9a Merge 'IO Cleanups to use and ' from Pedro Muniz
Depends on #2512 .
This is an attempt to remove all the noise from my IO completions
refactor into separate PRs

Closes #2566
2025-08-13 10:24:15 +03:00
Levy A.
6a37916b49 fix: rename indexed columns 2025-08-13 08:55:17 +03:00
Levy A.
45d959635c fix: check if index exists with the same name 2025-08-13 08:55:17 +03:00
Jussi Saurio
2a4404cd13 Merge 'move our dbsp-based views to materialized views' from Glauber Costa
We will implement normal SQLite-style view-as-an-alias for
compatibility, and will call our incremental views materialized views.

Closes #2571
2025-08-13 08:53:30 +03:00
Jussi Saurio
3e8a5b92ae Merge 'turso-sync: support checkpoint' from Nikita Sivukhin
remote protocol can require client to perform checkpoint of the WAL.
This PR supports that need in the sync-engine implementation

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

Closes #2565
2025-08-13 08:49:31 +03:00
pedrocarlo
85e86d427b cleanups - use io.block in many functions and return_if_io 2025-08-13 08:32:38 +03:00
Jussi Saurio
73a2851f0b Merge 'More State machines' from Pedro Muniz
Adds more state machines and does some minor adjustments in some other
functions like `commit_tx` and `execute`.

Closes #2512
2025-08-13 08:31:05 +03:00
Preston Thorpe
a0f70f04f2 Merge 'Rename page -> slot for arenas + buffer pool' from Preston Thorpe
No semantic changes here, just name changing for to prevent confusion as
@sivukhin pointed out.

Reviewed-by: Nikita Sivukhin (@sivukhin)

Closes #2564
2025-08-12 16:03:00 -04:00
Glauber Costa
770f86e490 move our dbsp-based views to materialized views
We will implement normal SQLite-style view-as-an-alias for
compatibility, and will call our incremental views materialized views.
2025-08-12 14:19:17 -05:00
Nikita Sivukhin
1ac3d632ca support checkpoint from remote 2025-08-12 19:53:04 +04:00
PThorpe92
5a4c2a6ce9 Rename page -> slot for arenas + buffer pool 2025-08-12 11:36:49 -04:00
pedrocarlo
217c9061e8 advance commit_tx state machine in mvcc tests 2025-08-12 12:28:35 -03:00
pedrocarlo
e94f1f9f14 refactor move_to functions to return IO on start 2025-08-12 12:28:35 -03:00
pedrocarlo
4010dc8f32 state machine for insert 2025-08-12 12:28:35 -03:00
pedrocarlo
78a89f0fd3 execute should create an Statement 2025-08-12 12:28:35 -03:00
pedrocarlo
10cadd4037 do not use StepResult for commit_txn 2025-08-12 12:28:35 -03:00
pedrocarlo
9ab07f59ad adjust mvcc state transitions 2025-08-12 12:28:35 -03:00
pedrocarlo
fc5492bf2c state machine for op_row_id 2025-08-12 12:28:35 -03:00
pedrocarlo
1221f65d10 state machine for op_column 2025-08-12 12:28:35 -03:00
pedrocarlo
fe0e4bcbb7 state machine for seek_end 2025-08-12 12:28:35 -03:00
pedrocarlo
fc05518192 refactor continue_payload_overflow_with_offset 2025-08-12 12:28:34 -03:00
pedrocarlo
81fbf8cb4b balance_non_root validation logic should be done in the next state 2025-08-12 12:28:34 -03:00
Pekka Enberg
0285fddd85 Merge 'Fix max_frame determination and comments in WAL checkpointing' from Preston Thorpe
in #2521, I messed up and introduced improper calculation of the current
checkpoint's max safe frame (mostly due to incorrect comments that I had
left on the method).
The confusion partially stems from our lack of Busy handling at the
moment, but essentially when determining the max safe frame for all
readers, for passive mode we cannot simply `break` out of the loop when
we find a reader with a lower read mark than we have, because _another_
reader might have an even _lower_ read mark, and we could proceed with
the first mark < shared_max.
And for !passive modes, we still attempt to backfill with the same lower
frame, we just return `Busy` at the end, after backfilling what we can
(we just don't reset the log for restart/truncate).
Most of the changes in this PR is just the renaming the fields of
Checkpoint Result, because the names were confusing

Closes #2560
2025-08-12 18:24:59 +03:00
Nikita Sivukhin
d66d6d0220 add few comments 2025-08-12 18:41:30 +04:00
Nikita Sivukhin
1d8ed9aa55 add methods for read/write schema cookie 2025-08-12 17:29:56 +04:00
PThorpe92
c3b536957f Fix max_frame determination and comments in WAL checkpointing 2025-08-12 08:57:35 -04:00
Jussi Saurio
0c9180426f Merge 'Direct schema mutation – add RenameColumn instruction' from Levy A.
<img width="934" height="511" alt="image" src="https://github.com/user-
attachments/assets/992e6c7e-5b4a-4cd2-9040-5d1f44ca55d0" />
<img width="973" height="261" alt="image" src="https://github.com/user-
attachments/assets/e179143a-92f3-427a-be9a-280ce6a739f6" />

Closes #2546
2025-08-12 10:19:31 +03:00
Jussi Saurio
9b5e61eacd Merge 'Reprepare fix on write statement' from Pedro Muniz
We have to update the Transaction State before checking for the Schema
Cookie so that we can rollback the transaction later on correctly.
Closes #2535

Closes #2549
2025-08-12 10:18:12 +03:00
Jussi Saurio
03373afe1f Merge 'core/wal: Minor checkpointing cleanups and optimizations' from Preston Thorpe
Small contribution to my current work on making checkpointing efficient.
We hold a write lock, and especially here on main there is no reason to
mark the pages as dirty in the cache, so we can do away with that
Vec<u64> and just track whether it's `Done`

Closes #2545
2025-08-12 10:16:51 +03:00
Pekka Enberg
db54c953bd Merge 'Implement Aggregations for DBSP views' from Glauber Costa
```
turso> create table t(a, b);
turso> insert into t(a,b) values (2,2), (3,3);
turso> insert into t(a,b) values (6,6), (7,7);
turso> insert into t(a,b) values (6,6), (7,7);
turso> create view tt as select b, sum(a) from t where b > 2 group by b;
turso> select * from tt;
┌───┬─────────┐
│ b │ sum (a) │
├───┼─────────┤
│ 3 │       3 │
├───┼─────────┤
│ 6 │      12 │
├───┼─────────┤
│ 7 │      14 │
└───┴─────────┘
turso> insert into t(a,b) values (1,3);
turso> select * from tt;
┌───┬─────────┐
│ b │ sum (a) │
├───┼─────────┤
│ 3 │       4 │
├───┼─────────┤
│ 6 │      12 │
├───┼─────────┤
│ 7 │      14 │
└───┴─────────┘
turso>
```

Closes #2547
2025-08-12 09:52:22 +03:00
Pekka Enberg
5303622802 Merge 'perf/btree: optimize op_column' from Jussi Saurio
Mainly the performance impact here comes from removing some unnecessary
checks and inlining `read_integer_fast()` directly into `op_column()`,
but I also added some fiddly nano-optimizations for fun
On main, we are roughly 3.4x slower than sqlite on `SELECT * FROM users
LIMIT 100`, and here we are roughly 3.2x slower, which ain't much, but
it's honest work.
A more impactful optimization, but a much more annoying refactor, would
be #2304

Closes #2516
2025-08-12 09:51:38 +03:00