Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/hip-pianos-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@powersync/op-sqlite': patch
---

Update op-sqlite to v11.2.13.
5 changes: 5 additions & 0 deletions .changeset/rotten-rats-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@powersync/react-native': patch
---

Fixed an issue where the read and write locks were executing mutually exclusively. A read conccurent with a write or another read should correctly proceed instead of being blocked until the other lock has released.
4 changes: 2 additions & 2 deletions packages/powersync-op-sqlite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"access": "public"
},
"peerDependencies": {
"@op-engineering/op-sqlite": "^10.1.0",
"@op-engineering/op-sqlite": "^11.2.13",
"@powersync/common": "workspace:^1.22.1",
"react": "*",
"react-native": "*"
Expand All @@ -75,7 +75,7 @@
"async-lock": "^1.4.0"
},
"devDependencies": {
"@op-engineering/op-sqlite": "^10.1.0",
"@op-engineering/op-sqlite": "^11.2.13",
"@react-native/eslint-config": "^0.73.1",
"@types/async-lock": "^1.4.0",
"@types/react": "^18.2.44",
Expand Down
4 changes: 1 addition & 3 deletions packages/powersync-op-sqlite/src/db/OPSqliteAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ export class OPSQLiteDBAdapter extends BaseObserver<DBAdapterListener> implement

this.readConnections = [];
for (let i = 0; i < READ_CONNECTIONS; i++) {
// Workaround to create read-only connections
let dbName = './'.repeat(i + 1) + dbFilename;
const conn = await this.openConnection(dbName);
const conn = await this.openConnection(dbFilename);
await conn.execute('PRAGMA query_only = true');
this.readConnections.push({ busy: false, connection: conn });
}
Expand Down
10 changes: 10 additions & 0 deletions packages/react-native/src/db/PowerSyncDatabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,14 @@ export class PowerSyncDatabase extends AbstractPowerSyncDatabase {
identifier: this.database.name
});
}

async readLock<T>(callback: (db: DBAdapter) => Promise<T>): Promise<T> {
await this.waitForReady();
return this.database.readLock(callback);
}

async writeLock<T>(callback: (db: DBAdapter) => Promise<T>): Promise<T> {
await this.waitForReady();
return this.database.writeLock(callback);
}
}
Loading
Loading