Commit Graph

6423 Commits

Author SHA1 Message Date
Avinash Sajjanshetty
4e91ed1201 Add Rickrolling Turso blog post to contrib 2025-07-22 13:07:33 +05:30
Pekka Enberg
f979903633 Merge 'Load static extensions once and store on Database instead of once per connection' from Preston Thorpe
To help make the connection speed faster, we don't need to register
these every time as they are compiled in.

Closes #2213
2025-07-22 09:16:22 +03:00
Pekka Enberg
830f3c7276 Fix typo in insert.ts 2025-07-22 09:12:30 +03:00
Pekka Enberg
30de02d526 testing: Add test case for duplicate SET in UPDATE
Refs #2117
2025-07-22 09:08:14 +03:00
Pekka Enberg
afc22da07c Merge 'Fix duplicate SET statement compatibility with SQLite' from Ihor Andrianov
For duplicate SET statements, SQLite uses last one

Closes #2117
2025-07-22 09:02:16 +03:00
Pekka Enberg
b03fe4669a Merge 'wal: write txn fail in case max_frame change midway' from Pere Diaz Bou
A write txn can only start if the current snapshot held by writer is
consistent with the one in shared state

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

Closes #2204
2025-07-22 09:01:44 +03:00
Pekka Enberg
c1ee91f500 Merge 'Add @tursodatabase/serverless package' from Pekka Enberg
This package is for serverless access to the Turso Cloud using SQL over
HTTP protocol. The purpose of this package is to provide the same
interface as `@tursodatabase/turso`, but for serverless environments
that cannot host the database engine.
The package also provides a `@libsql/client` compatibility layer in the
`@tursodatabase/serverless/compat` module for drop-in replacement for
existing clients.

Closes #2209
2025-07-22 08:56:22 +03:00
PThorpe92
a92126961d Remove duplicate case and just send Mutex along with schema for extension registrations 2025-07-21 20:06:14 -04:00
PThorpe92
d514304ac2 Remove unneeded changes 2025-07-21 19:24:24 -04:00
PThorpe92
f7ba8efdbd Switch back to std::mutex because it was an unnecessary change 2025-07-21 19:20:17 -04:00
PThorpe92
5e5b3ce071 Fix leak of extension CTX in cli/app 2025-07-21 19:09:58 -04:00
PThorpe92
411c4f059a Load compile time extensions on the initial db startup instead of once per conn 2025-07-21 19:09:31 -04:00
PThorpe92
5ebd3f7271 Change api of extension api context to support static extensions held on db 2025-07-21 19:08:27 -04:00
Pekka Enberg
7765bafb13 Add @tursodatabase/serverless package
This package is for serverless access to the Turso Cloud using SQL over
HTTP protocol. The purpose of this package is to provide the same
interface as `@tursodatabase/turso`, but for serverless environments
that cannot host the database engine.

The package also provides a `@libsql/client` compatibility layer in the
`@tursodatabase/serverless/compat` module for drop-in replacement for
existing clients.
2025-07-21 22:03:43 +03:00
Pekka Enberg
8f83b150b7 Merge 'Implement pragma database_list' from Glauber Costa
And also the CLI option .databases, which is just manipulating that.
This is one step in the road to attach.

Closes #2195
2025-07-21 17:13:26 +03:00
Glauber Costa
0545049d59 Implement pragma database_list
And also the CLI option .databases, which is just manipulating that.

This is one step in the road to attach.
2025-07-21 08:49:35 -05:00
Pekka Enberg
be88325fa8 Merge 'test/clickbench: fix clickbench' from Jussi Saurio
- enable indexes, otherwise it doesnt work at all
- rename limbo to tursodb
- use mode=list instead of mode=pretty for less bulky tursodb results
Closes #1925

Closes #2200
2025-07-21 15:01:26 +03:00
Pekka Enberg
a22c4b3b53 Merge 'Improve Antithesis tests' from Pekka Enberg
Improve the Antithesis parallel drivers:
* Enable indexes in the runs.
* Add `CREATE INDEX` and `DROP INDEX` parallel drivers.
* Add `CREATE TABLE`, `DROP TABLE`, and `ALTER TABLE` parallel drivers.

Closes #2203
2025-07-21 15:01:07 +03:00
Pekka Enberg
632e1a2952 antithesis: Improve index creation to sometimes use DESC too 2025-07-21 14:17:24 +03:00
Pekka Enberg
cd494a6ccd antithesis: Add ALTER TABLE parallel driver 2025-07-21 14:17:24 +03:00
Pere Diaz Bou
1933815233 wal: write txn fail in case max_frame change midway
A write txn can only start if the current snapshot held by writer is
consistent with the one in shared state
2025-07-21 13:08:56 +02:00
Pere Diaz Bou
fae0a67ff7 Merge ' core/lib: init_pager lock shared wal until filled ' from Pere Diaz Bou
maybe_shared_wal's lock is held for a limited time increasing the chance
of initializing the shared wal twice.

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

Closes #2201
2025-07-21 13:06:41 +02:00
Pere Diaz Bou
6dd8f6561d clippy 2025-07-21 12:53:56 +02:00
Jussi Saurio
d308f4d206 Merge 'fix/sim: actually enable indexes by default' from Jussi Saurio
Follow up to #2199 that _actually_ enables indexes by default in sim

Closes #2202
2025-07-21 13:44:51 +03:00
Pere Diaz Bou
4c59695351 test_multi_thread: ignore tests for now 2025-07-21 12:43:31 +02:00
Pekka Enberg
08e1f4a971 antithesis: Add DROP TABLE parallel driver 2025-07-21 13:40:28 +03:00
Pekka Enberg
bd30cb313c antithesis: Add CREATE TABLE parallel driver 2025-07-21 13:40:28 +03:00
Pekka Enberg
9788a8739c antithesis: Add DROP INDEX parallel driver 2025-07-21 13:40:28 +03:00
Pekka Enberg
02ccdd7194 antithesis: Add CREATE INDEX parallel driver 2025-07-21 13:40:28 +03:00
Jussi Saurio
e604a80e93 fix/sim: actually enable indexes by default 2025-07-21 13:35:11 +03:00
Pekka Enberg
ade013ae88 antithesis: Add shuffle-run.sh helper script 2025-07-21 12:56:20 +03:00
Pekka Enberg
29e7b41ca5 antithesis: Create indexes in first_setup.py 2025-07-21 12:55:37 +03:00
Pekka Enberg
0ebe6bb933 antithesis-tests: Enable indexes in Antithesis parallel drivers 2025-07-21 12:49:38 +03:00
Pekka Enberg
993079e39d bindings/python: Add "experimental_indexes" parameter to connect() 2025-07-21 12:49:38 +03:00
Pekka Enberg
87f0229e1f Merge 'test/stress&sim: enable indexes by default' from Jussi Saurio
Life is too boring without any simulator-created issues

Closes #2199
2025-07-21 12:39:57 +03:00
Pere Diaz Bou
c55cb74dc8 simple write multi threaded test 2025-07-21 11:06:31 +02:00
Pere Diaz Bou
e3fdb6bab9 core/lib: init_pager lock shared wal until filled
maybe_shared_wal's lock is held for a limited time increasing the chance
of initializing the shared wal twice.
2025-07-21 11:00:34 +02:00
Jussi Saurio
78320464ce test/clickbench: fix clickbench
- enable indexes, otherwise it doesnt work at all
- rename limbo to tursodb
- use mode=list instead of mode=pretty for less bulky tursodb results
2025-07-21 12:00:04 +03:00
Jussi Saurio
dce355d9b7 test/stress&sim: enable indexes by default 2025-07-21 11:49:30 +03:00
Jussi Saurio
d6bd9fc26e Merge 'fix/btree/balance: interior cell insertion can leave page overfull' from Jussi Saurio
- When an interior index cell is replaced, it can cause the page where
the
replacement happens to overflow OR underflow. On `main` we did not check
this case, because
the interior cell replacement always moves the cursor to a leaf, and if
the leaf
doesn't underflow, then no further balancing happens.
- The solution is to ALWAYS check whether the interior page where the
replacement
happens is underflowing OR overflowing, and balance that page regardless
of whether
the leaf page where the replacement was taken underflows or not.
So summary:
- InteriorCellReplacement: cell deleted from Interior page I,
replacement cell taken from Leaf L
  and inserted back to Interior page I.
- If Leaf L underflows:
  * balance it first
  * then balance I if it overflows OR underflows
- If Leaf L does NOT underflow:
  * balance I anyway if it overflows OR underflows
Closes https://github.com/tursodatabase/turso/issues/1701
Closes https://github.com/tursodatabase/turso/issues/2167

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

Closes #2168
2025-07-21 11:03:26 +03:00
Jussi Saurio
079a9fe0a5 Merge 'Fix error: Stable 1.88.0 is not available in Nix flake' from Levy A.
Fixed by just updating with `nix flake update`.
```
error:
       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:37:12:
           36|
           37|   strict = derivationStrict drvAttrs;
             |            ^
           38|

       … while evaluating derivation 'nix-shell'
         whose name attribute is located at /nix/store/wshnc0kqk1qz7iffb1yqri8a5cy6v7w5-source/pkgs/stdenv/generic/make-derivation.nix:375:7

       … while evaluating attribute '__impureHostDeps' of derivation 'nix-shell'
         at /nix/store/wshnc0kqk1qz7iffb1yqri8a5cy6v7w5-source/pkgs/stdenv/generic/make-derivation.nix:490:7:
          489|       __propagatedSandboxProfile = unique (computedPropagatedSandboxProfile ++ [ propagatedSandboxProfile ]);
          490|       __impureHostDeps = computedImpureHostDeps ++ computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps ++ __impureHostDeps ++ stdenv.__extraImpureHostDeps ++ [
             |       ^
          491|         "/dev/zero"

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: Stable 1.88.0 is not available
```

Closes #2150
2025-07-21 09:44:21 +03:00
Jussi Saurio
2967fafe73 Merge 'Usable space unwrap' from Pedro Muniz
Using `unwrap_or_default` can make `page_size` become 0 in this case,
which can lead to subtracting with overflow in `payload_threshold_max`
in case we have some sort of error. Better to unwrap the error here, as
in release mode we may not have overflow checks enabled to catch this.

Closes #2145
2025-07-21 00:23:06 +03:00
Jussi Saurio
cff4d7e16d Merge 'BTreeTable::to_sql: wrap special column names in brackets' from Nils Koch
Closes #2055

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

Closes #2126
2025-07-21 00:22:49 +03:00
Jussi Saurio
026cb7390c Merge 'fix/test: fix and unignore incorrectly implemented test' from Jussi Saurio
Turns out #2192 was just me implementing a test wrong -- `BEGIN` is ofc
an alias for `BEGIN DEFERRED` so just executing `BEGIN` won't start a tx
yet. In short: `tursodb` does what you'd expect under snapshot
isolation, at least in this specific instance.
In any case, let's not waste the test -- I've now unignored it and fixed
it.

Closes #2196
2025-07-21 00:06:18 +03:00
Jussi Saurio
81d8dc7e3d Merge 'Fix column order for multi-row insertion' from Nikita Sivukhin
Column order handled incorrectly for multi-rows insert case
```sql
turso> CREATE TABLE t(x, y, z);
turso> INSERT INTO t(z, x) VALUES (1, 2), (3, 4);
turso> SELECT * FROM t;
┌───┬───┬───┐
│ x │ y │ z │
├───┼───┼───┤
│   │ 2 │   │
├───┼───┼───┤
│   │ 4 │   │
└───┴───┴───┘
```

Closes #2109
2025-07-21 00:02:43 +03:00
Jussi Saurio
9936748132 Merge 'Avoid redundant decoding of record headers when reading sorted chunk files' from Iaroslav Zeigerman
Currently, each record header is decoded at least twice: once to
determine the record size within the read buffer (in order to construct
the `ImmutableRecord` instance), and again later when decoding the
record for comparison. This redundant decoding can have a noticeable
negative impact on performance when records are wide (eg. contain
multiple columns).
This update modifies the (de)serialization format for sorted chunk files
by prepending a record size varint to each record payload. As a result,
only a single varint needs to be decoded to determine the record size,
eliminating the need to decode the full record header during reads.

Closes #2176
2025-07-20 23:54:54 +03:00
Jussi Saurio
8a6f3f589c Merge 'compat: change page_size pragma and RowData opcode to yes' from meteorgan
page_size pragma: #2053
RowData opcode: #1756

Closes #2187
2025-07-20 23:53:11 +03:00
Jussi Saurio
34f91fc727 Merge 'doc: fix intra-repo links for contribution guide and license, and expand binding links' from bit-aloo
Small README cleanup:
1. Updated the contribution guide and license link to point to the local
CONTRIBUTING.md and LICENSE.md file instead of GitHub’s default page.
2. Linked each language in the bindings list to its respective
subdirectory for easier navigation.

Closes #2190
2025-07-20 23:52:45 +03:00
Jussi Saurio
a9a43f5644 Merge 'Explain the Turso challenge' from Glauber Costa
The challenge is not being mentioned where it matters most: in the
Github Readme, where developers are!
Fix it.

Closes #2193
2025-07-20 23:52:09 +03:00
Jussi Saurio
21d1781ef9 fix/test: fix and unignore incorrectly implemented test 2025-07-20 23:48:54 +03:00