@bastani/atomic-storage-libsql 0.9.70 → 0.9.71
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 +12 -0
- package/libsql.js +5 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.9.71] - 2026-11-03
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Several processes opening one `file:` database at once no longer fail the open with `SQLITE_BUSY: database is locked` while the file is switched to the write-ahead log. SQLite does not wait for another connection's lock while it changes a file's journal mode, so the switch failed at once whenever another process was writing a file still in the rollback journal, such as a new file or one from before the adapter used WAL, or switching it at the same moment. The open now retries the switch for up to the 5-second busy timeout, as every other statement waits ([#4270](https://github.com/bastani-inc/atomic/issues/4270))
|
|
10
|
+
|
|
11
|
+
## [0.9.71-alpha.1] - 2026-11-03
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- Several processes opening one `file:` database at once no longer fail the open with `SQLITE_BUSY: database is locked` while the file is switched to the write-ahead log. SQLite does not wait for another connection's lock while it changes a file's journal mode, so the switch failed at once whenever another process was writing a file still in the rollback journal, such as a new file or one from before the adapter used WAL, or switching it at the same moment. The open now retries the switch for up to the 5-second busy timeout, as every other statement waits ([#4270](https://github.com/bastani-inc/atomic/issues/4270))
|
|
16
|
+
|
|
5
17
|
## [0.9.55] - 2026-10-30
|
|
6
18
|
|
|
7
19
|
### Fixed
|
package/libsql.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
import { createSqliteDatabase, redactSecrets, StorageAdapterLoadError } from "@bastani/atomic/storage";
|
|
2
|
+
import { createSqliteDatabase, redactSecrets, StorageAdapterLoadError, switchToWriteAheadLog } from "@bastani/atomic/storage";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @typedef {{ url: string, authToken?: string, namespace?: string, headers?: Readonly<Record<string, string>> }} LibsqlDatabaseOptions
|
|
@@ -156,8 +156,10 @@ export async function openLibsqlDatabase({ url, authToken, namespace, headers })
|
|
|
156
156
|
await database.exec("PRAGMA foreign_keys = ON");
|
|
157
157
|
// Readers and the one writer of a file share it through the write-ahead log, as in Atomic's own SQLite stores;
|
|
158
158
|
// in the default rollback journal a read refuses a writer's commit and the other way round. The mode is stored
|
|
159
|
-
// in the file, so this changes it once and costs nothing afterwards.
|
|
160
|
-
|
|
159
|
+
// in the file, so this changes it once and costs nothing afterwards. SQLite does not wait for another
|
|
160
|
+
// connection's lock while it changes the mode, so the switch waits out the busy timeout itself: several
|
|
161
|
+
// processes opening one new file at once, or one writing it, would otherwise fail the open with SQLITE_BUSY.
|
|
162
|
+
if (local) await switchToWriteAheadLog((sql) => database.exec(sql), FILE_BUSY_TIMEOUT_MS);
|
|
161
163
|
return database;
|
|
162
164
|
} catch (error) {
|
|
163
165
|
await database.close().catch(() => {});
|