Commit Graph

5762 Commits

Author SHA1 Message Date
Pekka Enberg
5dfbe8db08 Merge 'bindings/java: Merge JavaScript test suites' from Mikaël Francoeur
I modified the `better-sqlite3.spec.mjs` test suite to use the dual test
runner from https://github.com/tursodatabase/turso/pull/1941 and I
deleted the `limbo.spec.mjs` test suite, because it's now redundant.
I looked carefully at the diff between the two test suites to make sure
that we didn't lose any coverage with this change.

Closes #1959
2025-07-06 10:44:35 +03:00
Pekka Enberg
bbf938041b Fix example in README.md
We currently have indexing disabled by default, which means non-rowid
primary keys are disabled too.

Fixs #1961
2025-07-06 10:37:49 +03:00
Pekka Enberg
a833f9e33a Merge 'Add multi select test in JDBC4StatementTest' from Kim Seon Woo
In reponse to [discord discussion](https://discord.com/channels/12586588
26257961020/1385754749634084885/1390535068401012858), I thought it would
be better to add a test to show how JDBC4Statement can be used.

Closes #1962
2025-07-06 10:15:15 +03:00
김선우
c8bb2e73ec Add multi select test in JDBC4StatementTest 2025-07-05 09:36:27 +09:00
Mikaël Francoeur
38c650380c fix nvim messup 2025-07-04 11:19:27 -04:00
Mikaël Francoeur
d8d26463db add new test 2025-07-04 11:18:47 -04:00
Mikaël Francoeur
4b1fdc457d fix typo 2025-07-04 11:17:24 -04:00
Mikaël Francoeur
a427751e3a merge js binding test suites 2025-07-04 10:13:05 -04:00
Pekka Enberg
c28c83fa2c Fix formatting in Cargo.toml 2025-07-04 12:54:58 +03:00
Pekka Enberg
b9bba101d4 Rename limbo_stress to turso_stress 2025-07-04 12:53:58 +03:00
Pekka Enberg
6e79a11dc7 Merge 'bindings/dart initial implementation' from Andika Tanuwijaya
re-upload

Closes #1911
2025-07-04 10:43:19 +03:00
Pekka Enberg
38c6183adf Merge 'bindings/javascript: Implement Database.open' from Lucas Forato
Reviewed-by: Diego Reis (@el-yawd)

Closes #1834
2025-07-04 10:28:50 +03:00
Pekka Enberg
793fa495e8 Merge 'Import JavaScript bindings test suite from libSQL' from Mikaël Francoeur
This PR imports the `sync` test suite from libSQL, and modifies the
export structure match `better-sqlite3`, so that at least a few tests
from the new test suite are passing.
I also changed the `package.json` to expose `wrapper.js` as an
entrypoint. I think the plain `index.js` was probably never meant to be
exposed directly to clients, because the wrapper does some important
transformation. It's also how libSQL-js is
[structured](https://github.com/tursodatabase/libsql-
js/blob/main/package.json#L20).
## DualTest test runner
The test suite that I imported was previously run twice, with different
environment variables: one run for libSQL-js, one run for better-
sqlite3. This worked well with libSQL, because it's compatible with
better-sqlite3. But Turso isn't there yet, so even though all tests need
to run on better-sqlite3, not all tests are passing on Turso.
To make it possible to run the test suite on both implementation, and to
make it possible to track the progress of Turso, I've added a `DualTest`
test runner that emulates the API of the Ava test runner, but instead of
a single `test()` function, it exposes two methods: `both()`, and
`onlySqlitePasses()`. The first one runs the test on both
implementations, and the second one also runs it on both, but expects
that Turso will fail.
When Turso is completely compatible with better-sqlite3, it will be easy
to remove the dual-test runner, since it has the same API as Ava.
## Future development
### Existing tests
The existing tests were divided in two files: `better-sqlite3.spec.mjs`,
and `dual-test.mjs` that are kept in sync manually. The first one is
mostly a superset of the second one, with additional tests indicating
behaviour that isn't implemented in Turso yet. I want to merge these
test suites to also use the dual-test test runner. This will make it
easier to evolve test suites and to track the progress of Turso.
### `SqliteError`
Modifying the test called `errors` to `both()` will show that Turso is
still missing an `SqliteError` type, to be compatible with better-
sqlite3. I have the required changes in a stash and will open a PR
shortly.
-----
as part of https://github.com/tursodatabase/turso/issues/1900

Closes #1941
2025-07-04 10:26:58 +03:00
Pekka Enberg
16a7416d0e cargo dist: s/limbo/turso/ 2025-07-04 10:13:50 +03:00
Pekka Enberg
f46bd6f40d Merge 'bindings/java: Rename to Turso' from Diego Reis
Closes #1936
2025-07-04 10:06:19 +03:00
Pekka Enberg
97ea4f1a80 Merge 'add libsql_disable_wal_checkpoint' from Pedro Muniz
Closes #1894

Closes #1920
2025-07-04 10:04:00 +03:00
Pekka Enberg
6a2404a3ff Merge 'Add a threshold for large page cache values' from Krishna Vishal
Added a threshold to clip input page cache size values to `0`. This
avoid the panic at runtime and also follow's SQLite behavior closely.
Now:
```
Turso v0.1.1
Enter ".help" for usage hints.
This software is ALPHA, only use for development, testing, and experimentation.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database
turso> PRAGMA main.cache_size = 5022422913188235998;
turso> PRAGMA main.cache_size;
┌────────────┐
│ cache_size │
├────────────┤
│         10 │
└────────────┘
```
Closes: https://github.com/tursodatabase/turso/issues/1952

Closes #1954
2025-07-04 10:01:06 +03:00
Krishna Vishal
19d949521a Add a threshold to clip large page cache values to 0. This prevents
panic at runtime.
2025-07-04 10:24:10 +05:30
Mikaël Francoeur
50d542b719 expose wrapper and use default import 2025-07-03 15:19:03 -04:00
Mikaël Francoeur
6faa81034c add and adapt test suite from libsql 2025-07-03 15:19:03 -04:00
Pekka Enberg
1aad782271 Merge 'Antithesis schema rollback tests' from Pekka Enberg
Closes #1940
2025-07-03 21:28:17 +03:00
Pekka Enberg
c3e8bfab34 Merge 'Disable adaptive colors when output_mode is list' from meteorgan
As adaptive colors use `OSC 11` to query the terminal's background
color,  the query string may contaminate test result and cause failures
when running tests in a terminal.
```
 make test-vector

SQLITE_EXEC=scripts/limbo-sqlite3 ./testing/vector.test
(testing/testing.db)                        Running test: vector-functions-valid
Test FAILED: SELECT vector_extract(vector('[]'));
  SELECT vector_extract(vector('  [  1  ,  2  ,  3  ]  '));
  SELECT vector_extract(vector('[-1000000000000000000]'));
returned '[]
[1,2,3]
[-1000000000000000000]'
expected '[]
[1,2,3]
[-1000000000000000000]'
^[]11;rgb:158e/193a/1e75^[\make: *** [test-vector] Error 1
```

Closes #1942
2025-07-03 19:35:05 +03:00
Pekka Enberg
82a727bcf2 antithesis: Fix Python linter complaints in parallel_driver_schema_rollback.py 2025-07-03 19:34:23 +03:00
meteorgan
ccfee3f418 disable adaptive colors when output_mode is list 2025-07-03 23:31:51 +08:00
pedrocarlo
56d87cb916 move disable behavior to connection instead of checkpoint 2025-07-03 12:05:53 -03:00
pedrocarlo
3861584edc add test for wal checkpointing correctly 2025-07-03 12:04:17 -03:00
pedrocarlo
44b8275b26 add test + implement sqlite3_column_int64 for test 2025-07-03 12:04:17 -03:00
pedrocarlo
db005c81a0 add option to disable wal checkpoint 2025-07-03 12:04:17 -03:00
Diego Reis
4b32577f80 bind/java: Rename to Turso 2025-07-03 10:56:05 -03:00
Pekka Enberg
6a3042b5d4 antithesis: Add schema rollback parallel driver 2025-07-03 16:50:50 +03:00
Pekka Enberg
9303244f9d bindings/python: Explicit transaction control support 2025-07-03 16:50:21 +03:00
Pekka Enberg
603e57aff8 bindings/python: Fix ROLLBACK 2025-07-03 16:36:18 +03:00
Pekka Enberg
9e92325bad antithesis: Make experiments run for longer
...increases probability of Antithesis finding interesting things.
2025-07-03 15:58:49 +03:00
Pekka Enberg
90e035b6b0 Merge 'Rollback schema support' from Pere Diaz Bou
Fixes #1890
Once rollback was implement we quickly saw that it lacked support for
schema changes so we had to re-estructure things a bit.
## Example of failure:
```bash
turso> begin;
turso> create table t(x);
turso> rollback;
turso> pragma integrity_check;
thread 'main' panicked at core/storage/sqlite3_ondisk.rs:386:36:
called `Result::unwrap()` on an `Err` value: Corrupt("Invalid page type: 83")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
This happened because it thought table `t` existed because we didn't
rollback that schema.
## Changes:
* The most important change: now every connection has a private copy of
schema. On write txn commit we update a global schema shared between
connections in order for new connections to get updated version from
there. In case of rollback, we simply change connection's schema to
previous version. This change allowed us to remove locks for schema
private copy and keeping schema changes locally in case of concurrency.
 Sqlite does things differently, they lazily parse schema in case of
outdated schema, this many schema changes to trigger reading schema from
db file which is slow. If we are able to keep local copy in memory, even
when if we add multiprocessing, it will speed up schema reloading by a
bunch.
* `schema_cookie` is now update for every schema change
* `Insn::ParseSchema` had a nasty bug where it would commit all the
changes made in a query that changed a schema, we fixed that by setting
`auto_commit` to `false` before parsing schema, and setting it back to
previous value once schema is parsed.

Closes #1928
2025-07-03 14:18:00 +03:00
Pekka Enberg
1b3317e6c8 Merge 'core/storage: Switch to turso_assert in btree.rs' from Pekka Enberg
Let's help out Antithesis to find interesting bugs.

Closes #1937
2025-07-03 13:58:34 +03:00
Pere Diaz Bou
5eca507867 fix type null spacing 2025-07-03 12:53:15 +02:00
Pere Diaz Bou
2cfd209e56 clippy 2025-07-03 12:40:08 +02:00
Pere Diaz Bou
151debcb63 fix to_sql btreetable 2025-07-03 12:36:48 +02:00
Pere Diaz Bou
6b16950488 fmt 2025-07-03 12:36:48 +02:00
Pere Diaz Bou
06685ac191 fix formatting create table in rollback.test 2025-07-03 12:36:48 +02:00
Pere Diaz Bou
470fb8d23b rollabck translate remove querymode 2025-07-03 12:36:48 +02:00
Pere Diaz Bou
cde7202981 Revert "Merge 'core: Disable ROLLBACK statement' from Pekka Enberg"
This reverts commit 8a13e4b02f, reversing
changes made to cc935f97cc.
2025-07-03 12:36:48 +02:00
Pere Diaz Bou
a6954ee9aa index test 2025-07-03 12:36:48 +02:00
Pere Diaz Bou
f37893eb8f set cookie for index operations 2025-07-03 12:36:48 +02:00
Pere Diaz Bou
ba988685cf set cookie create virtual table 2025-07-03 12:36:48 +02:00
Pere Diaz Bou
5d856499c4 move update schema global on commit and not on rollback txn 2025-07-03 12:36:48 +02:00
Pere Diaz Bou
2414502268 parse schema set auto_commit false in nested query 2025-07-03 12:36:48 +02:00
Pere Diaz Bou
d8658264d9 alter set cookie 2025-07-03 12:36:48 +02:00
Pere Diaz Bou
c1e87d7f24 more tests 2025-07-03 12:36:48 +02:00
Pere Diaz Bou
9590768914 few more schema change rollback tests 2025-07-03 12:36:48 +02:00