Commit graph

111 commits

Author SHA1 Message Date
Pekka Enberg
b4a331da38
Merge 'SDK tweaks' from Nikita Sivukhin
Few small tweaks in SDKs:
1. Export `ConnectionSync` type from Python SDK
2. Remove dependency on `conn_raw_api` and corresponding methods from
rust bindings - no one use them so let's drop support for this feature
completely
3. Add Waker dependency in the sdk-kit in order to integrate it later to
rust bindings
4. Add io_uring feature to the sdk-kit

Closes #4284
2025-12-22 11:59:02 +02:00
Nikita Sivukhin
7a79adc958 make resume re-entrant 2025-12-21 14:24:05 +04:00
Nikita Sivukhin
367083a4b5 fix bug in sync server implementation 2025-12-21 11:54:54 +04:00
Preston Thorpe
2a4eb02095
Merge 'Sync fixes' from Nikita Sivukhin
Some checks are pending
Build & publish @tursodatabase/database / db-bindings-x86_64-pc-windows-msvc - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-aarch64-apple-darwin - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-aarch64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-wasm32-wasip1-threads - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-x86_64-pc-windows-msvc - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / Test DB bindings on Linux-x64-gnu - node@20 (push) Blocked by required conditions
Build & publish @tursodatabase/database / Test DB bindings on browser@20 (push) Blocked by required conditions
Build & publish @tursodatabase/database / Publish (push) Blocked by required conditions
Python / configure-strategy (push) Waiting to run
Python / test (push) Blocked by required conditions
Python / lint (push) Waiting to run
Python / linux (x86_64) (push) Waiting to run
Python / macos-arm64 (aarch64) (push) Waiting to run
Python / sdist (push) Waiting to run
Python / Release (push) Blocked by required conditions
Rust / cargo-fmt-check (push) Waiting to run
Rust / build-native (blacksmith-4vcpu-ubuntu-2404) (push) Waiting to run
Rust / build-native (macos-latest) (push) Waiting to run
Rust / build-native (windows-latest) (push) Waiting to run
Rust / clippy (push) Waiting to run
Rust / simulator (push) Waiting to run
Rust / test-limbo (push) Waiting to run
Rust / test-sqlite (push) Waiting to run
Rust Benchmarks+Nyrkiö / vfs-bench-compile (push) Waiting to run
Rust Benchmarks+Nyrkiö / bench (push) Waiting to run
Rust Benchmarks+Nyrkiö / clickbench (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h-criterion (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h (push) Waiting to run
This PR introduces few sync fixes relevant to the partial sync feature:
1. Make `try_wal_watermark_read_page` async - this is important as now
db file can be partial and require extra network IO for fetching missing
pages
2. Do not panic if requested page doesn't exist on server - this can be
valid case if db on the server has smaller size
3. Maintain clean db file size in order to avoid reads outside of the
file (this can happen, when we revert new pages allocated only in the
WAL and need to fetch their previous state if there is one)

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

Closes #4297
2025-12-19 17:56:01 -05:00
Nikita Sivukhin
a261440180 fix for windows 2025-12-19 16:44:34 +04:00
Nikita Sivukhin
6393aa20eb add asserts 2025-12-19 16:21:47 +04:00
Nikita Sivukhin
18f8919870 maintain clean file size for lazy database storage implementation 2025-12-19 16:03:35 +04:00
Nikita Sivukhin
02596136d0 do not panic if requested page is not available at remote server - this can happen during valid code pathes 2025-12-19 16:02:24 +04:00
Pekka Enberg
4c1bc1ba95
Merge 'Improve MVCC DX by dropping --experimental-mvcc flag' from Pekka Enberg
Some checks are pending
Build & publish @tursodatabase/database / db-bindings-x86_64-pc-windows-msvc - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-aarch64-apple-darwin - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-aarch64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-wasm32-wasip1-threads - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-x86_64-pc-windows-msvc - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / Test DB bindings on Linux-x64-gnu - node@20 (push) Blocked by required conditions
Build & publish @tursodatabase/database / Test DB bindings on browser@20 (push) Blocked by required conditions
Build & publish @tursodatabase/database / Publish (push) Blocked by required conditions
Python / sdist (push) Waiting to run
Python / Release (push) Blocked by required conditions
Python / configure-strategy (push) Waiting to run
Python / test (push) Blocked by required conditions
Python / lint (push) Waiting to run
Python / linux (x86_64) (push) Waiting to run
Python / macos-arm64 (aarch64) (push) Waiting to run
Rust / simulator (push) Waiting to run
Rust / test-limbo (push) Waiting to run
Rust / test-sqlite (push) Waiting to run
Rust / cargo-fmt-check (push) Waiting to run
Rust / build-native (blacksmith-4vcpu-ubuntu-2404) (push) Waiting to run
Rust / build-native (macos-latest) (push) Waiting to run
Rust / build-native (windows-latest) (push) Waiting to run
Rust / clippy (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h (push) Waiting to run
Rust Benchmarks+Nyrkiö / vfs-bench-compile (push) Waiting to run
Rust Benchmarks+Nyrkiö / bench (push) Waiting to run
Rust Benchmarks+Nyrkiö / clickbench (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h-criterion (push) Waiting to run
The DX is right now pretty terrible:
```
penberg@vonneumann turso % cargo run -- hello.db
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.15s
     Running `target/debug/tursodb hello.db`
Turso v0.4.0-pre.18
Enter ".help" for usage hints.
Did you know that Turso supports live materialized views? Type .manual materialized-views to learn more.
This software is in BETA, use caution with production data and ensure you have backups.
turso> PRAGMA journal_mode = 'experimental_mvcc';
  × Invalid argument supplied: MVCC is not enabled. Enable it with `--experimental-mvcc` flag in the CLI or by setting the MVCC option in `DatabaseOpts`

turso>
```
To add insult to the injury, many SDKs don't even have a way to enable
MVCC via database options. Therefore, let's remove the flag altogether.

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

Closes #4294
2025-12-19 13:59:34 +02:00
Nikita Sivukhin
7796347aa4 make rollback process async
- this is not important at the moment - but can be important later when we will start to evict pages from partial database file
2025-12-19 15:55:05 +04:00
Pekka Enberg
edd45ff7b8 Improve MVCC DX by dropping --experimental-mvcc flag
The DX is right now pretty terrible:

```
penberg@vonneumann turso % cargo run -- hello.db
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.15s
     Running `target/debug/tursodb hello.db`
Turso v0.4.0-pre.18
Enter ".help" for usage hints.
Did you know that Turso supports live materialized views? Type .manual materialized-views to learn more.
This software is in BETA, use caution with production data and ensure you have backups.
turso> PRAGMA journal_mode = 'experimental_mvcc';
  × Invalid argument supplied: MVCC is not enabled. Enable it with `--experimental-mvcc` flag in the CLI or by setting the MVCC option in `DatabaseOpts`

turso>
```

To add insult to the injury, many SDKs don't even have a way to enable
MVCC via database options. Therefore, let's remove the flag altogether.
2025-12-19 12:59:42 +02:00
Nikita Sivukhin
ff6909add3 fix doc comments 2025-12-18 16:32:45 +04:00
Nikita Sivukhin
327562fdf3 Merge branch 'main' into local-sync-server 2025-12-18 15:13:56 +04:00
Nikita Sivukhin
8b1673747d wip 2025-12-18 15:00:03 +04:00
Nikita Sivukhin
e090b23b19 fix compilation 2025-12-18 12:57:16 +04:00
Nikita Sivukhin
f4a1a91ba2 remove unnecessary dependencies 2025-12-18 12:22:06 +04:00
Nikita Sivukhin
5ab69bcf20 rename speculative load to prefetch (docs already uses this terminology) 2025-12-16 13:59:39 +04:00
Nikita Sivukhin
340d39ac08 wip 2025-12-13 21:51:39 +04:00
Nikita Sivukhin
f07a51968a implement simple sync server in the CLI 2025-12-12 17:36:04 +04:00
Preston Thorpe
73289c6325
Merge 'Go driver' from Nikita Sivukhin
This PR brings back go driver to the turso monorepo and adds sync
support for the golang.
It depends on the pre-compiled binaries at
https://github.com/tursodatabase/turso-go-platform-libs repository
There is a CI which trigger build on the turso-go-platform-libs repo in
case when release tag is published

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

Closes #4085
2025-12-11 09:52:15 -05:00
Nikita Sivukhin
bd69bf2adb fix typo 2025-12-10 23:17:06 +04:00
Nikita Sivukhin
f409875c69 adjust python tests a little bit 2025-12-10 18:37:28 +04:00
Nikita Sivukhin
fd335d7f06 refine changes result usage and regenerate client 2025-12-10 18:23:45 +04:00
Nikita Sivukhin
2ea0709344 return null if no changes were fetched from remote 2025-12-10 18:23:45 +04:00
Nikita Sivukhin
a499906643 fix clippy 2025-12-10 18:23:44 +04:00
Nikita Sivukhin
cf350b917e fix use-after-free error with stats result 2025-12-10 18:23:44 +04:00
Nikita Sivukhin
6f3df5fa89 adjust header and capi bindings for turso-sync sdk kit 2025-12-10 18:23:41 +04:00
Nikita Sivukhin
7cdc17db00 add comment 2025-12-10 17:09:29 +04:00
Nikita Sivukhin
4a180dd659 improve error messages at sync engine 2025-12-10 17:08:24 +04:00
Nikita Sivukhin
42e1b75a4a do not send request for zero pages 2025-12-09 16:01:24 +04:00
Nikita Sivukhin
617aa2d713 add comments 2025-12-09 14:41:56 +04:00
Nikita Sivukhin
f513f66f20 cargo clippy --fix 2025-12-09 14:20:32 +04:00
Nikita Sivukhin
dc1ff11a5b add speculative load logic 2025-12-09 14:07:10 +04:00
Nikita Sivukhin
2244f411ca load larger chunks from the remote 2025-12-09 13:13:44 +04:00
Jussi Saurio
826ca4d44d chore: remove experimental_indexes feature flags 2025-12-08 13:00:37 +02:00
Nikita Sivukhin
6e30a3ce90 cargo fmt 2025-12-02 18:18:14 +04:00
Nikita Sivukhin
201f3a55f6 fix clippy 2025-12-02 18:16:57 +04:00
Nikita Sivukhin
43992bf2c4 fix sync engine and sdk kit 2025-12-02 17:22:35 +04:00
Nikita Sivukhin
4b7cd523f5 handle memory io properly in sync engine 2025-12-02 16:03:45 +04:00
Nikita Sivukhin
1da46bda6b more docs 2025-12-02 00:58:52 +04:00
Nikita Sivukhin
8f4b0ba3cd slightly refactor sync engine 2025-12-01 22:51:22 +04:00
Nikita Sivukhin
71be25fa14 add sdk-kit for turso-sync 2025-12-01 22:51:08 +04:00
Nikita Sivukhin
3cad64e5e4 rename weird ProtocolIo to the SyncEngineIo 2025-11-28 21:40:52 +04:00
Pekka Enberg
1f79fbc22c
Merge 'Partial sync basic' from Nikita Sivukhin
This PR implements basic support for partial sync. Right now the scope
is limited to only `:memory:` IO and later will be properly expanded to
the file based IO later.
The main addition is `PartialDatabaseStorage` which make request to the
remote server for missing local pages on demand.
The main change is that now tursodatabase JS bindings accept optional
"external" IO event loop which in case of sync will drive `ProtocolIo`
internal work associated with remote page fetching tasks.

Closes #3931
2025-11-13 16:38:04 +02:00
Nikita Sivukhin
740ff2b4a6 fix clippy 2025-11-12 16:46:15 +04:00
Nikita Sivukhin
15dafd46c1 replace turso_assert -> assert 2025-11-12 16:40:38 +04:00
Nikita Sivukhin
3d14092679 fix 2025-11-12 16:38:04 +04:00
Nikita Sivukhin
72089d2682 adjust compilation 2025-11-12 16:30:50 +04:00
Nikita Sivukhin
aa65cfd55d update Cargo.toml 2025-11-12 16:14:14 +04:00
Nikita Sivukhin
a25e3e76eb wip 2025-11-12 13:21:34 +04:00