Commit Graph

126 Commits

Author SHA1 Message Date
Mayank Verma
12104df16a await on .close() 2025-09-10 13:42:21 +05:30
Mayank Verma
aa38c9e099 make reconnect() async 2025-09-10 13:08:06 +05:30
Mayank Verma
745feb131f add Connection.reconnect() to serverless driver 2025-09-10 02:17:12 +05:30
Pekka Enberg
9aff35e5af packages/turso-serverless: Fix blob type handling 2025-08-22 14:17:40 +03:00
Pekka Enberg
54b4fdaa7d javascript: Implement transactions API 2025-08-19 16:35:44 +03:00
Pekka Enberg
387d384394 javascript: Implement Statement.columns() 2025-08-19 16:35:44 +03:00
Pekka Enberg
5002539b04 javascript: Implement safe integers 2025-08-19 16:35:44 +03:00
Pekka Enberg
6b59bcd51e javascript: Fix Statement.get() for boundary values 2025-08-19 16:35:44 +03:00
Pekka Enberg
e99f189344 javascript: Implement Statement.pluck() 2025-08-19 16:35:44 +03:00
Pekka Enberg
69e8f7fa31 Move sync engine to sync/engine 2025-08-18 15:41:54 +03:00
Pekka Enberg
13b805a992 Move @tursodatabase/sync code to sync/javascript 2025-08-18 14:23:20 +03:00
Pekka Enberg
3a72b478d2 Turso 0.1.4-pre.9 2025-08-18 12:55:45 +03:00
Nikita Sivukhin
b9a23f3067 fix clippy 2025-08-15 17:01:40 +04:00
Nikita Sivukhin
fef4e7e0e6 move tests from tursodb repo to turso-server repo 2025-08-15 16:59:53 +04:00
Nikita Sivukhin
979e7da633 use sql-over-http instead of WAL push 2025-08-15 16:59:43 +04:00
Nikita Sivukhin
ac26e1cbe5 use DatabaseReplayGenerator in the DatabaseTape 2025-08-15 13:23:25 +04:00
Nikita Sivukhin
e6dafafccc extract stateless component for generting replay queries 2025-08-15 13:23:25 +04:00
Nikita Sivukhin
36106a2d6c parse bin record early 2025-08-15 13:23:25 +04:00
Nikita Sivukhin
34a7b2ffd4 ignore changes in the turso_sync_last_change_id 2025-08-14 12:39:44 +04:00
Nikita Sivukhin
8c9d648852 add test which check that we don't push without the need 2025-08-14 12:38:15 +04:00
Nikita Sivukhin
f603a0dfc8 change log level to INFO in order to simplify debugging (DEBUG logs in the db are pretty spammy) 2025-08-14 12:37:49 +04:00
Nikita Sivukhin
887b25dd00 do not push wal unnecessary when nothing was changed locally 2025-08-13 20:22:10 +04:00
Nikita Sivukhin
eff8d8540d fix bug and add test with concurrent dbs in sync 2025-08-13 17:08:07 +04:00
Nikita Sivukhin
2ca8a15dcc switch from Buffer to Vec<u8> for now as buffers are not supported by default in browser 2025-08-13 17:00:01 +04:00
Nikita Sivukhin
33ef1aa0da add tracing option to the SyncEngine 2025-08-13 17:00:01 +04:00
Nikita Sivukhin
0d9d0762a9 fix clippy 2025-08-13 16:57:44 +04:00
Nikita Sivukhin
734750daaa fix after rename 2025-08-13 15:26:25 +04:00
Nikita Sivukhin
0a12b2d74a disable auto-checkpoint for opened connections in the sync engine 2025-08-13 15:23:18 +04:00
Nikita Sivukhin
6e0ad0a483 open draft database only once
- otherwise there will be problems with memory IO backend
2025-08-13 15:23:18 +04:00
Pekka Enberg
2ba28892dc serverless: 0.1.3 2025-08-13 09:56:43 +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
Pekka Enberg
a6247e891f Turso 0.1.4-pre.8 2025-08-12 19:51:42 +03:00
Pekka Enberg
475799b3e9 Unify JavaScript package README files 2025-08-12 19:30:02 +03:00
Nikita Sivukhin
8040604362 fix clippy 2025-08-12 19:54:11 +04:00
Nikita Sivukhin
1ac3d632ca support checkpoint from remote 2025-08-12 19:53:04 +04:00
Nikita Sivukhin
bf863803da add simple test with checkpoint 2025-08-12 19:49:21 +04:00
Pekka Enberg
97ad901d96 Merge 'simple README with warning' from Nikita Sivukhin
Closes #2562
2025-08-12 18:24:53 +03:00
Pekka Enberg
2e79333de4 Merge 'turso-sync: fix schema bug' from Nikita Sivukhin
This PR fixes few issues in turso-sync-engine implementation:
1. One step of `pull` implementation works like this:
   a. Start write WAL session
   b. Revert local changes in WAL
   c. Replay WAL frames from remote DB
   d. Replay WAL frames produced by local changes applied to the remote
DB copy (`synced`)
My initial thinking was that by executing step (d) we will get the same
schema as before (with same schema cookie) and everything will be fine.
With more deep thinking we can see that it's not fine - as after step
(d) tables created locally can change their root pages (if they were
created locally, for example) - and DB will have "broken" schema
2. Sync engine execute few SQL statements and do not run them to
completion - which basically created "orphaned" locks
In order to fix (1) I decided to introduce another `conn_raw_api`
extension which allows to read and write schema cookie directly in the
transaction. So, the process described above adds step (e) which set
schema cookie to the value strictly greater than the value before.
In order to fix (2) I just fixed all places where statement were dropped
before running to completion.
These fixes are merged together because I explored them by fixing one
new test: `test_sync_single_db_many_pulls_big_payloads`

Closes #2561
2025-08-12 18:24:46 +03:00
Nikita Sivukhin
02bb891104 add npm badge 2025-08-12 18:55:39 +04:00
Nikita Sivukhin
35b51d8302 simple README with warning 2025-08-12 18:52:58 +04:00
Nikita Sivukhin
bf2a01866c fix clippy 2025-08-12 18:33:12 +04:00
Nikita Sivukhin
d3a27ee311 fix sync engine 2025-08-12 18:30:16 +04:00
Pekka Enberg
5a65617602 Turso 0.1.4-pre.7 2025-08-12 17:01:47 +03:00
Pekka Enberg
bfefa44632 Merge 'turso-sync: support updates and schema changes' from Nikita Sivukhin
Add support for schema changes and granular updates in the
`DatabaseTape` and turso-sync-engine
Now, schema changes made locally will be replicated to the remote too.
Also, `UPDATE`s made locally will touch only changed columns (before we
did `DELETE` + `INSERT` which can overwrite non-conflicting changes from
another device to the same row).
Note, that schema changes replication for now can be pretty dangerous,
as we can't extract proper schema at some moment in time from turso_cdc
and always use latest schema columns. This means that it's better to
avoid `ALTER TABLE ...` to be executed locally, but basic DDL like
`CREATE TABLE / CREATE INDEX / DROP TABLE / DROP INDEX` will work fine
(as columns only appear/disappear for schema in this case).

Closes #2540
2025-08-12 09:50:26 +03:00
Nikita Sivukhin
aa5de7b8bd fix clippy 2025-08-11 17:02:36 +04:00
Nikita Sivukhin
eb40d4aff6 remove turso-sync as now we have turso-sync-engine 2025-08-11 16:53:39 +04:00
Nikita Sivukhin
372d23b7cc handle schema changes in sync engine 2025-08-11 16:52:18 +04:00
Nikita Sivukhin
5e773d286e support UPDATEs and schema changes in database tape 2025-08-11 16:50:59 +04:00
PThorpe92
84ffed709a Round up allocation for wal frame arena to next page multiple of 64 2025-08-08 10:55:29 -04:00
Pekka Enberg
81da795a66 Turso 0.1.4-pre.6 2025-08-08 16:50:24 +03:00