Skip to content

Commit 541e7f9

Browse files
committed
Address minor review comments on multi-process core
- Darwin notification name prefix com.powersync.changes (was co.). - Simplify the changelog entry to one feature bullet, dropping the internal-only details. - Document that only the main app should call connect(); extensions can read and write the shared database but must not open a second sync connection.
1 parent dac1f69 commit 541e7f9

3 files changed

Lines changed: 7 additions & 14 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,8 @@
44

55
* `PowerSyncDatabase(dbFilename:)` now accepts an absolute path (starting with `/`), used
66
as-is so the database can live in an App Group container shared with app extensions.
7-
Plain filenames keep the existing behavior, and `close(deleteDatabase: true)` deletes the
8-
files at the absolute location.
9-
* Opening the connection pool retries while another process holds the database. The
10-
`pragma journal_mode = WAL` transition reports `SQLITE_BUSY`/`SQLITE_BUSY_RECOVERY`
11-
without consulting the busy handler, so concurrent cold opens (an app launching while its
12-
extension opens the same file) used to fail; the pool now retries with backoff.
13-
* Added an opt-in cross-process change signal: each pool posts a Darwin notification after
14-
every committed write and, on receipt, re-emits `tableUpdates` with
15-
`EXTERNAL_CHANGES_MARKER` so `watch` queries and the upload client wake for writes made by
16-
other processes sharing the database file. Only databases opened from an absolute path
17-
(an App Group container) use the signal; in-memory and default-directory databases skip
18-
it, since they can't be shared across processes.
7+
Plain filenames keep the existing behavior. The SDK coordinates opening the database to
8+
avoid conflicts and can share update notifications across the main app and extensions.
199

2010
## 1.14.3
2111

Sources/PowerSync/Implementation/CrossProcessChangeSignal.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final class CrossProcessChangeSignal: @unchecked Sendable {
2424
init(databasePath: String, logger: any LoggerProtocol) {
2525
// Stable across processes: both sides derive the name from the canonical path.
2626
let canonical = URL(fileURLWithPath: databasePath).standardizedFileURL.path
27-
self.name = "co.powersync.changes.\(Self.fnv1a(canonical))"
27+
self.name = "com.powersync.changes.\(Self.fnv1a(canonical))"
2828
self.logger = logger
2929
}
3030

Sources/PowerSync/PowerSyncDatabase.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ public let DEFAULT_DB_FILENAME = "powersync.db"
99
/// - dbFilename: The database filename. Defaults to "powersync.db". Plain names are
1010
/// stored in the default databases directory; an absolute path (starting with "/") is
1111
/// used as-is, which allows sharing the database with app extensions through an App
12-
/// Group container.
12+
/// Group container. The database itself can be used concurrently from the main app and
13+
/// its extensions, but only the main app should call `connect`. Two sync connections on
14+
/// the same database waste resources and are untested (and could corrupt the sync
15+
/// client); let extensions read and write, and leave syncing to the app.
1316
/// - logger: Optional logging interface
1417
/// - initialStatements: An optional list of statements to run as the database is opened.
1518
/// - Returns: A configured PowerSyncDatabase instance

0 commit comments

Comments
 (0)