@bastani/atomic-storage-libsql 0.9.88-alpha.1 → 0.9.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.9.88] - 2026-11-16
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Statements outside a transaction on a libSQL server (sqld) or Turso database now reuse one Hrana stream instead of opening a new one for every request ([#5151](https://github.com/bastani-inc/atomic/issues/5151)). sqld loads the database's schema for every stream it opens, so the server's work for each request grew with the number of tables: on one sqld, a pooled workflow round used 6.0 s of server CPU with no other tables, 8.3 s with 100 and 13.1 s with 400; it now uses 2.9, 3.2 and 3.8 s. Only reads and writes (`SELECT`, `INSERT`, `UPDATE`, `DELETE`, `REPLACE`, `WITH`, `VALUES`) reuse the stream; schema changes, pragmas, transaction control, transactions and write batches keep a stream of their own, so a reused stream never holds a transaction or the write lock. A stream idle 5 seconds or open 60 seconds is closed and a new one opened, before sqld would expire it. A statement is sent again only when the server refused it without running it, because the stream had expired or its baton was refused before anything ran; a statement whose answer was lost, or any other refusal, is not, and the next statement opens a new stream. Each statement on a kept stream is preceded, in the same request, by a read of `sqlite_schema`, so the stream's connection rereads a schema another process changed: without it, a kept connection compiled the next statement against the old schema, and `SELECT *` returned the old columns. A stream's first request that fails no longer sends the server a close for a stream it never opened.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- A libSQL server (sqld) or Turso database no longer stays locked for the stream's whole lifetime after an outage that cut a stream holding a write transaction. The client sends the close of a stream it gives up on once, and in an outage that close failed too, so the server kept the stream, its open transaction and the database's write lock: every writer, in this process and every other, waited for it, and a worker host could stay stuck for over a minute after the database came back. The adapter now sends such a close again, waiting 250 ms and then twice as long each time up to 8 s, until the server answers it, for at most 5 minutes, and stops when the database closes; a close that reaches the server frees the lock at once. When the outage lost the answer to a request the server had already run, the server refuses the close as a used baton, the adapter does not send it again, and the lock clears when the server expires the stream, about 5 seconds on sqld ([#5114](https://github.com/bastani-inc/atomic/issues/5114)).
|
|
14
|
+
- An HTTP 5xx answer with no libSQL error in it, such as a gateway's 502 or 504 in front of sqld or Turso, is now a `StorageTransientError` with code `connection-lost`. Its outcome is `"unknown"` for a commit, a batch or a statement outside a transaction, because the server may have applied the request before the answer was lost. Before, it was a plain `StorageUnavailableError`, and a session save the server had applied counted as failed ([#4970](https://github.com/bastani-inc/atomic/issues/4970)).
|
|
15
|
+
- A value over a libSQL server's limit (`SQLITE_TOOBIG`, or `ARGS_INVALID: string or blob too big`; 5,000,000 bytes by default in sqld) and a response over its 10 MB limit (`RESPONSE_TOO_LARGE`) are no longer reported as `StorageUnavailableError`. They fail with `StoragePayloadTooLargeError`, which names the size and sqld's default limit and is never retried. Atomic's sessions and snapshots now store large values in rows of at most 1 MiB, so they stay under these limits ([#4954](https://github.com/bastani-inc/atomic/issues/4954))
|
|
16
|
+
- A libSQL server (sqld) database no longer fails a write with `SQLITE_BUSY: database is locked` when the write meets the server's checkpoint. sqld answers such a write `SQLITE_BUSY` at once, without running any of it, and leaves the waiting to the client, so a write that coincided with a checkpoint failed with `StorageUnavailableError`. A statement outside a transaction, an `exec` of one statement, a batch, or the start of a transaction that the server answers busy now runs again with growing waits for up to 5 seconds. A statement the server answers busy after its transaction began, and several statements in one `exec`, do not run again ([#4817](https://github.com/bastani-inc/atomic/issues/4817)).
|
|
17
|
+
- Closing a `file:` database no longer crashes the process on Windows. `libsql` 0.5.29, the native driver `@libsql/client` uses, closes a local connection's SQLite handle twice when the connection holds its last reference ([tursodatabase/libsql#2251](https://github.com/tursodatabase/libsql/issues/2251)). The second close reads freed memory, and Windows ends the process with `0xC0000005` and no message. A process with several connections open took that path on the close after its first, because each close's garbage collections finalized the other connections' statements. The adapter now closes each local connection while a statement still holds it, so the handle closes once. A `libsql` release built with the crate fix ([tursodatabase/libsql#2261](https://github.com/tursodatabase/libsql/pull/2261)) makes this unnecessary ([#4824](https://github.com/bastani-inc/atomic/issues/4824)).
|
|
18
|
+
- Fixed many processes writing to one sqld or Turso database stalling each other ([#4768](https://github.com/bastani-inc/atomic/issues/4768)). A write batch that finds the server's write lock busy is now sent again after a short random wait that grows up to a second, for as long as the caller's `lockWaitMs` allows. Each process sends at most four write batches to a server at once; a batch with `priority` skips that limit. A request the server leaves unanswered for 30 seconds is abandoned, as a transient failure whose outcome is unknown, instead of waiting for the network's own timeout. Three write requests in a row left unanswered print a warning (`ATOMIC_LIBSQL_WRITES_STALLED`) naming [tursodatabase/libsql#2286](https://github.com/tursodatabase/libsql/issues/2286), a sqld bug that stops it taking writes until it restarts, and its workaround: start sqld with `--checkpoint-interval-s 60`. The first write answered afterwards prints `ATOMIC_LIBSQL_WRITES_RECOVERED`
|
|
19
|
+
- A libSQL server that stops answering writes no longer holds back writes to another server from the same process. The limit of four write batches in flight now applies to each server separately, so writes to a healthy server, and the calls queued behind them on that database, go on while another server is stalled ([#4790](https://github.com/bastani-inc/atomic/issues/4790))
|
|
20
|
+
- A statement whose leading comments a regular expression could split many ways, such as `/**//**//**/… PRAGMA …`, no longer stalls the process deciding whether it may reuse the open stream. That check used to backtrack exponentially in the number of comments; it now reads the statement once, and it ends a block comment at its first `*/`, as SQLite does.
|
|
21
|
+
|
|
5
22
|
## [0.9.88-alpha.1] - 2026-11-16
|
|
6
23
|
|
|
7
24
|
### Changed
|
package/package.json
CHANGED