Skip to content

Conversation

simolus3
Copy link
Contributor

On the web, use BEGIN EXCLUSIVE instead of a regular BEGIN when starting a write transaction. The motivation for this is:

  1. A regular BEGIN will start as a read transaction and then upgrade to a write transaction when necessary. Since we're likely to issue writing statements in writeTransaction, we can skip the read->write upgrade step.
  2. In particular with WA-sqlite, obtaining locks is implemented by the VFS returning BUSY and then automatically retrying the SQLite call. There were some issues with this and the new Rust sync client. We will fix those in a core extension update, but obtaining a write transaction directly instead of in powersync_control could still avoid some of those retries.

@simolus3 simolus3 requested a review from rkistner June 30, 2025 22:45
Copy link

changeset-bot bot commented Jun 30, 2025

🦋 Changeset detected

Latest commit: 3f3f25b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@powersync/web Patch
@powersync/diagnostics-app Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@simolus3 simolus3 merged commit b398483 into main Jul 1, 2025
9 checks passed
@simolus3 simolus3 deleted the write-tx-exclusive branch July 1, 2025 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants