Commit Graph

7820 Commits

Author SHA1 Message Date
pedrocarlo
2d6fad5ea3 nit: adjust order of struct completions 2025-08-19 10:48:21 -03:00
pedrocarlo
fadf78fe67 use a dedicated Error enum for Completion Error 2025-08-19 10:48:21 -03:00
pedrocarlo
7bc0545442 default impl for get_memory_io 2025-08-19 10:48:21 -03:00
pedrocarlo
d5a59c6bee default impl for generate_random_number 2025-08-19 10:48:21 -03:00
pedrocarlo
f72bcbc5da default impl for wait_for_completion + check for errors in completion there 2025-08-19 10:48:21 -03:00
pedrocarlo
002390b5a5 store error inside Completion 2025-08-19 10:48:21 -03:00
pedrocarlo
d0c13f0104 remove IOError from Parser + store only ErrorKind in LimboError 2025-08-19 10:48:21 -03:00
Pekka Enberg
54c02b6ae0 Merge 'bindings/javascript: Rename to ' from Pekka Enberg
We already have a `@tursodatabase/sync` package so let's make the name
of the better-sqlite3 compatibility API package stand out.

Closes #2667
2025-08-19 16:35:23 +03:00
Jussi Saurio
1200a1dd44 Merge 'Small pager cleanups' from Jussi Saurio
Reviewed-by: Preston Thorpe <preston@turso.tech>

Closes #2668
2025-08-19 16:04:11 +03:00
Jussi Saurio
ac37e89fe1 remove unused PAGE_ERROR flag 2025-08-19 15:44:16 +03:00
Jussi Saurio
33eb730ef8 finish_read_page() never fails, so it does not need to return Result 2025-08-19 15:44:16 +03:00
Jussi Saurio
687e593361 Add pgno field to CacheError::Locked for debugging 2025-08-19 15:44:16 +03:00
Preston Thorpe
ea5896b4ea Merge 'Add helper to convert io::clock::Instant to useable format ' from Preston Thorpe
I needed this for another PR

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

Closes #2654
2025-08-19 08:18:52 -04:00
Jussi Saurio
366281eeab Merge 'Do not begin or end transactions in nested statement' from Jussi Saurio
Closes #2657
Closes #2659
Closes #2660
Closes #2661
1. In simulator, do not assume every error that happens after fault
injection has the literal error message `"Injected fault"`. If an error
happened, all we need to do is not shadow the query into the in-memory
simulator environment -- in other words, we assume whatever the
statement did failed and was rolled back.
2. Do not begin or end transactions inside a nested statement. Nested
statements generally only occur when `ParseSchema` is invoked, which
runs the equivalent of `SELECT * FROM sqlite_schema`. This does not need
a new transaction nor does it need to end the transaction on error,
since the parent statement will handle it.

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

Closes #2666
2025-08-19 14:25:33 +03:00
Pekka Enberg
692323ae9b bindings/javascript: Rename @tursodatabase/database/sync to compat
We already have a `@tursodatabase/sync` package so let's make the name of the
better-sqlite3 compatibility API package stand out.
2025-08-19 13:20:34 +03:00
Pekka Enberg
7c2bdac7ca Merge 'bindings/javascript: Add TypeScript declarations to package' from Pekka Enberg
Fixes #2621

Closes #2665
2025-08-19 13:18:00 +03:00
Jussi Saurio
7f1eac9560 Do not start or end transaction in nested statement 2025-08-19 13:03:14 +03:00
Jussi Saurio
97657a86b3 Do not assume error message content in FaultyQuery 2025-08-19 12:49:01 +03:00
Pekka Enberg
976403b080 bindings/javascript: Add TypeScript declarations to package
Fixes #2621
2025-08-19 12:34:49 +03:00
Preston Thorpe
91cf63215f Merge 'add missing closing tag' from Glauber Costa
should have been added to the previous commit

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

Closes #2656
2025-08-18 21:21:31 -04:00
Glauber Costa
b66e90bf9a add missing closing tag
should have been added to the previous commit
2025-08-18 18:18:54 -07:00
Preston Thorpe
82fe508609 Merge 'add metrics and implement the .stats command' from Glauber Costa
This adds basic statement and connection metrics like SQLite (and
libSQL) have.
This is particularly useful to show that materialized views are working:
turso> create table t(a);
turso> insert into t(a) values (1) , (2), (3), (4), (5), (6), (7), (8),
(9), (10); turso> create materialized view v as select count(*) from t;
turso> .stats on
Stats display enabled.
turso> select count(*) from t;
┌───────────┐
│ count (*) │
├───────────┤
│        10 │
└───────────┘
Statement Metrics:
  Row Operations:
    Rows read:        10
    Rows written:     0
    [ ... other metrics ... ]
turso> select * from v;
┌───────────┐
│ count (*) │
├───────────┤
│        10 │
└───────────┘
Statement Metrics:
  Row Operations:
    Rows read:        1
    Rows written:     0
    [ ... other metrics ... ]

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

Closes #2651
2025-08-18 20:26:48 -04:00
Preston Thorpe
f912139817 Merge 'make the MCP server instructions more visible on the README' from Glauber Costa
Right now it is buried under "console".
We have also not updated the list of commands when we added two more,
and this is done in this PR.

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

Closes #2655
2025-08-18 20:13:55 -04:00
Preston Thorpe
b5538eb90c Merge 'Add bench-sqlite script and makefile command' from Preston Thorpe
<img width="436" height="480" alt="image" src="https://github.com/user-
attachments/assets/d95572cf-b775-43d9-b3fa-b6b1c9ecc64d" />
(cherry-picked example, yes on io_uring we do well with some write
workloads against sqlite)
adds:
`make bench-sqlite VFS=io_uring SQL="insert into products (name,price)
values (1,2);" N=10000`

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

Closes #2652
2025-08-18 20:00:25 -04:00
Glauber Costa
c6aadeafa2 make the MCP server instructions more visible on the README
Right now it is buried under "console".

We have also not updated the list of commands when we added two more,
and this is done in this PR.
2025-08-18 16:31:49 -07:00
PThorpe92
d3d01cefc8 Add to_system_time for our io::clock::Instant type 2025-08-18 19:27:37 -04:00
PThorpe92
1f31903723 dont time the first iteration of sqlite benchmark 2025-08-18 17:39:50 -04:00
Jussi Saurio
9deedd917f Merge 'FaultyQuery enabled by default' from Pedro Muniz
FaultyQuery was disabled. We were not simulating faults.

Reviewed-by: Avinash Sajjanshetty (@avinassh)
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #2594
2025-08-18 22:53:37 +03:00
PThorpe92
d8faae1b99 Make python linter happy 2025-08-18 15:46:30 -04:00
Pekka Enberg
ac7a7325fc Merge 'Fix simulator docker build by adding new sync directory' from Preston Thorpe
workspace changed

Closes #2653
2025-08-18 22:38:03 +03:00
PThorpe92
ef389db64b Fix simulator docker build by adding new sync directory 2025-08-18 15:32:22 -04:00
Preston Thorpe
b302951fd4 Merge 'hide our age' from Glauber Costa
This PR lets us pretend we are younger than our real age, by using uv
like all the cool kids.

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

Closes #2645
2025-08-18 15:14:03 -04:00
PThorpe92
4fab57767b Add bench-sqlite script and makefile command for benchmarking an I/O backend against sqlite3 2025-08-18 15:11:29 -04:00
pedrocarlo
d96a26aef9 Property TableHasExpectedContent should just check the expected
content on runtime, not generation time
2025-08-18 16:00:59 -03:00
pedrocarlo
aa7f8fbfc4 Tripwire for Wal Syncing + set syncing to true before calling sync 2025-08-18 15:34:20 -03:00
Pekka Enberg
077247ad52 Merge ' core/mvcc: schema_did_change support and find last valid version ' from Pere Diaz Bou
1. Find latest version available of a row for a specific transaction.
For that we need to keep track which txid is finding a row.
2. Support for schema_did_change on commit txn
3. Extract the connection transaction state from non mvcc transactions
to
mvcc too.

Closes #2642
2025-08-18 19:22:24 +03:00
Pekka Enberg
e6804feb52 Merge 'make sure our responses are compliant with MCP' from Glauber Costa
There is an inconsistency now on how we are handling IDs and
notifications. Claude Code doesn't complain (good boi), but Claude
Desktop does.

Closes #2649
2025-08-18 19:21:50 +03:00
Pekka Enberg
2b7355d126 Merge 'Move sync code to own directory' from Pekka Enberg
Reviewed-by: Nikita Sivukhin (@sivukhin)

Closes #2643
2025-08-18 19:21:34 +03:00
pedrocarlo
2954e2e7bf shrinking: remove table assertions for non-dependent tables 2025-08-18 12:44:49 -03:00
pedrocarlo
59da828362 do not shadow FaultyQuery's immediately. Only shadow them later 2025-08-18 12:40:02 -03:00
pedrocarlo
c5dc26f542 reset more pager state machines in rollback 2025-08-18 12:01:10 -03:00
pedrocarlo
7fb14cfc76 add File path to SimulatorFile 2025-08-18 11:52:10 -03:00
pedrocarlo
6388ed2017 FaultyQuery enabled by default 2025-08-18 11:52:10 -03:00
Glauber Costa
36fc8e8fdb add metrics and implement the .stats command
This adds basic statement and connection metrics like SQLite (and
libSQL) have.

This is particularly useful to show that materialized views are working:

turso> create table t(a);
turso> insert into t(a) values (1) , (2), (3), (4), (5), (6), (7), (8), (9), (10);
turso> create materialized view v as select count(*) from t;
turso> .stats on
Stats display enabled.
turso> select count(*) from t;
┌───────────┐
│ count (*) │
├───────────┤
│        10 │
└───────────┘

Statement Metrics:
  Row Operations:
    Rows read:        10
    Rows written:     0
    [ ... other metrics ... ]

turso> select * from v;
┌───────────┐
│ count (*) │
├───────────┤
│        10 │
└───────────┘

Statement Metrics:
  Row Operations:
    Rows read:        1
    Rows written:     0
    [ ... other metrics ... ]
2025-08-18 09:11:06 -05:00
Pere Diaz Bou
94cd504d4c core/mvcc: support schema_did change on commit_txn
This not only changes schema_did_change on commit_txn for mvcc, but also
extracts the connection transaction state from non mvcc transactions to
mvcc too.
2025-08-18 15:52:10 +02:00
Glauber Costa
40efaab382 make sure our responses are compliant with MCP
There is an inconsistency now on how we are handling IDs and
notifications. Claude Code doesn't complain (good boi), but Claude
Desktop does.
2025-08-18 08:02:30 -05:00
Pekka Enberg
69e8f7fa31 Move sync engine to sync/engine 2025-08-18 15:41:54 +03:00
Glauber Costa
fc385a0be2 hide our age
This PR lets us pretend we are younger than our real age, by using uv
like all the cool kids.
2025-08-18 07:24:33 -05:00
Pere Diaz Bou
f8c110e664 core/mvcc: find latest valid version for row for every operation
Previously we only checked first version of row...
2025-08-18 13:54:10 +02:00
Pekka Enberg
13b805a992 Move @tursodatabase/sync code to sync/javascript 2025-08-18 14:23:20 +03:00