Commit Graph

10673 Commits

Author SHA1 Message Date
Glauber Costa
c15ac87a3c fix cursor validation
We are validating that the weights on the materialized view table are
-1, 0, and 1. This is only true for the aggregator operator. For DBSP
in general, any number will do.

Our algorithm, however, would have deleted anything from the BTree that
is <= 0. So we don't expect them here.
2025-09-11 05:30:46 -07:00
Glauber Costa
e6008e532a Add a second delta to the EvalState, Commit
We will assert that the second one is always empty for the existing
operators - as they should be!

But joins will need both.
2025-09-11 05:30:46 -07:00
Glauber Costa
6541a43670 move hashable_row to dbsp.rs
There will be a new type for joins, so it makes less sense to have
a separate file just for it. dbsp.rs is good.
2025-09-11 05:30:46 -07:00
Glauber Costa
1fd345f382 unify code used for persistence.
We have code written for BTree (ZSet) persistence in both compiler.rs
and operator.rs, because there are minor differences between them. With
joins coming, it is time to unify this code.
2025-09-11 05:30:46 -07:00
Glauber Costa
8997670936 include dbsp tables in the list of tables that cannot be modified 2025-09-11 05:30:46 -07:00
zongkx
92e211f278 Merge remote-tracking branch 'origin/main' 2025-09-11 12:26:52 +00:00
zongkx
d7096bdd28 fix executeUpdate updated count 2025-09-11 12:25:14 +00:00
zongkx
22cbd3a02c Merge branch 'tursodatabase:main' into main 2025-09-11 20:18:11 +08:00
zongkx
5d6e97b46b add executeUpdate updated count 2025-09-11 12:17:05 +00:00
TcMits
4c17fa87c5 remove .explain() 2025-09-11 18:28:46 +07:00
TcMits
68e8d5a36b clippy 2025-09-11 18:16:01 +07:00
TcMits
830e10da8f resolve merge conflict 2025-09-11 18:13:29 +07:00
Jussi Saurio
e3bd00883b Fix creation of automatic indexes
indexes with the naming scheme "sqlite_autoindex_<tblname>_<number>"
are automatically created when a table is created with UNIQUE or
PRIMARY KEY definitions.

these indexes must map to the table definition SQL in definition order,
i.e. sqlite_autoindex_foo_1 must be the first instance of UNIQUE or
PRIMARY KEY and so on.

this commit fixes our autoindex creation / parsing so that this invariant
is upheld.
2025-09-11 14:11:30 +03:00
Jussi Saurio
b9e2879f74 Add fuzz test for CREATE TABLE
This fuzz test verifies that various CREATE TABLE definitions with
UNIQUE and PRIMARY KEY definitions pass sqlite integrity_check.
2025-09-11 14:11:30 +03:00
TcMits
b56cb0b403 useless file 2025-09-11 18:06:54 +07:00
TcMits
b574b4bcea finish EXPLAIN 2025-09-11 18:04:59 +07:00
Jussi Saurio
bb74b2eaf9 Merge 'Refactor parseschema' from Jussi Saurio
Extracts out duplicated logic from `Schema::make_from_btree()` and
`parse_schema_rows()`

Closes #3015
2025-09-11 13:35:36 +03:00
Jussi Saurio
dc9fc8c0c6 Merge 'Fix value conversion for function parameters' from Levy A.
Value conversion to float for math functions work in a more strict way
than general numeric conversion. For example, valid prefixes that can be
converted to a integer, like `"44s"` will be converted to `Value::Null`
instead of trying to recover like the math operators.

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

Closes #3012
2025-09-11 13:34:07 +03:00
Jussi Saurio
7ac18a6952 Merge 'Remove some traces in super hot paths in btree' from Preston Thorpe
Particularly we were tracing `ImmutableRecord` / `BTreeKey` which would
then trace the bytes of records. These are super super hot paths and I
think we can probably remove even more to under debug assertions so we
dont eat those atomics/branches all the time.
This PR also introduces the `tracing_release` feature, which turns all
`trace!` and `debug!` macro invocations to noops at compile time, and
makes that feature available for all bindings.
it also removes the unused `lru` dependency, and cleans up the makefile
a bit

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

Closes #2995
2025-09-11 13:33:25 +03:00
Pekka Enberg
ae3c1fc2a6 Turso 0.2.0-pre.1 2025-09-11 11:44:42 +03:00
Pekka Enberg
5ae4756760 Merge 'Sync package opfs' from Nikita Sivukhin
This PR adds OPFS support to the sync package and also restructure it in
the similar fashion as in #2799
The structure for sync packages looks like this:
1. `@tursodatabase/sync-common` - package with common abstract TS code
shared between node and browser
2. `@tursodatabase/sync` - native package for node
3. `@tursodatabase/sync-browser` - browser package
Also, additional package `@tursodatabase/database-browser-common` was
extracted to share some common OPFS related code between
`@tursodatabase/database-browser` and `@tursodatabase/sync-browser`
packages.
Also, this PR moves JS bindings for sync directly to the
`bindings/javascript` folder because this allows to use all 7 packages
within same workspace.

Closes #3014
2025-09-11 11:44:26 +03:00
TcMits
a7373c9a97 update some helper function 2025-09-11 15:12:38 +07:00
Nikita Sivukhin
020b3f61f3 add CI step for debugging in future 2025-09-11 11:41:28 +04:00
Pekka Enberg
772af0d692 Merge 'Ensure that Connection::query() checks whether its schema is up to date' from Jussi Saurio
Closes #2997
Fixes issue #2997 where connection 2 cannot see tables created by
another connection 1, because `Connection::query()` was not checking
whether its copy of the schema was stale.

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

Closes #3008
2025-09-11 10:10:39 +03:00
Jussi Saurio
f17997fc5d Extract methods for populating indices/views from schema 2025-09-11 09:51:46 +03:00
Jussi Saurio
07944e23b5 Extract common logic for handling sqlite_schema rows 2025-09-11 09:45:40 +03:00
Pekka Enberg
89d1c9a421 whopper: Switch to mmap2 crate to fix Windows build 2025-09-11 08:35:18 +03:00
Pekka Enberg
c5ca259abc whopper: Run cargo clippy --fix 2025-09-11 08:35:18 +03:00
Pekka Enberg
ae920c435d whopper: Ragnarök mode with cosmic rays 2025-09-11 08:35:18 +03:00
Pekka Enberg
a9694c87b1 whopper: A new DST with concurrency
This is a new deterministic simulator for Turso that focuses on finding
concurrency bugs.

You can run whopper with:

```console
penberg@vonneumann turso % SEED=1234 ./whopper/bin/run
   Compiling turso_whopper v0.1.5-pre.3 (/Users/penberg/src/tursodatabase/turso/whopper)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 2.22s
seed = 1234
       .             I/U/D/C
       .             44/19/11/2
       .             68/33/21/2
       |             104/51/29/3
       |             121/69/41/3
      ╱|╲            150/84/51/3
     ╱╲|╱╲           184/97/59/3
    ╱╲╱|╲╱╲          199/105/64/4
   ╱╲╱╲|╱╲╱╲         206/115/69/5
  ╱╲╱╲╱|╲╱╲╱╲        234/138/82/6
 ╱╲╱╲╱╲|╱╲╱╲╱╲       269/164/91/7
```
2025-09-11 08:35:18 +03:00
Pekka Enberg
74c14efdfa sql_generation: Add support for DROP INDEX 2025-09-11 08:35:18 +03:00
Pekka Enberg
b572366a2b core/vbe: Demote op_transaction() logging to debug 2025-09-11 08:35:18 +03:00
Pekka Enberg
ca51a60b3c core/storage: Demote restart_log() logging to debug 2025-09-11 08:35:18 +03:00
Levy A.
4070e05cd2 fix: math function parameter conversion 2025-09-10 20:49:30 -03:00
Nikita Sivukhin
47592f976d fix workflow file 2025-09-11 00:19:48 +04:00
Nikita Sivukhin
d54c271890 add explicit dependency 2025-09-11 00:17:58 +04:00
Nikita Sivukhin
53967cb8fb do not test sync - because it needs server for now 2025-09-11 00:10:54 +04:00
Nikita Sivukhin
1a4d334e47 fix clippy and remove old action yaml 2025-09-11 00:03:01 +04:00
Nikita Sivukhin
fde376f36c fix CI one more time 2025-09-10 23:56:59 +04:00
Jussi Saurio
5f410fd568 Add missing maybe_update_schema() calls
Connection::query() was not properly checking whether it needs to
refresh its schema.
2025-09-10 22:44:26 +03:00
Nikita Sivukhin
1eec8f85f4 fix CI 2025-09-10 23:40:49 +04:00
Nikita Sivukhin
9e9d5f56de yarn install 2025-09-10 23:03:17 +04:00
Nikita Sivukhin
aef0a6c83b fix CI 2025-09-10 23:02:11 +04:00
Nikita Sivukhin
0aa9d59438 rebuild 2025-09-10 22:48:37 +04:00
Preston Thorpe
a93fe6be52 Merge 'refactor cli: readline will write to input_buf' from Lâm Hoàng Phúc
`readline` will directly write to `input_buf` instead of returning
`String`

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

Closes #2977
2025-09-10 14:39:38 -04:00
Nikita Sivukhin
11e582c058 update update-script 2025-09-10 22:35:58 +04:00
Nikita Sivukhin
d55026f84f opfs for sync in one commit! 2025-09-10 22:35:57 +04:00
TcMits
0ef5712d64 Merge branch 'main' into cli-1 2025-09-11 00:15:27 +07:00
TcMits
5caf9a2640 make it more safe + clippy 2025-09-11 00:14:38 +07:00
Pekka Enberg
656b0af1be Document DEFERRED and IMMEDIATE transaction modes 2025-09-10 19:39:58 +03:00