Skip to content

Fix rollbacks after failed commits - #1178

Merged
simolus3 merged 1 commit into
mainfrom
fix-tx-rollback
Oct 28, 2026
Merged

simolus3 merged 1 commit into
mainfrom
fix-tx-rollback

Conversation

@simolus3

Copy link
Copy Markdown
Contributor

When a COMMIT for a transaction fails, we issue a ROLLBACK statement instead to revert the transaction. Because TransactionImplementation can only issue one of those statements however, the rollback() call had no effect. This avoids the issue by running the ROLLBACK statement directly against the underlying context.

A similar issue exists in the Kysely driver, where we've always resolved the writeTransaction() callback. Kysely calls rollbackTransaction() if a prior commitTransaction call failed, our current setup there sets this.#tx = null too early and swallows the error. For consistency, this changes the Kysely implementation to forward errors as well.

Closes #1176.

AI use: Claude found the Kysely issue while reviewing the other change, I also used Claude to fix it.

@changeset-bot

changeset-bot Bot commented Oct 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 052b3b7

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

This PR includes changesets to release 7 packages
Name Type
@powersync/kysely-driver Patch
@powersync/common Patch
@powersync/node Patch
@powersync/react-native Patch
@powersync/tanstack-react-query Patch
@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 marked this pull request as ready for review October 27, 2026 14:36
@simolus3
simolus3 requested a review from Chriztiaan October 27, 2026 14:37
Comment thread packages/common/src/db/DBAdapter.ts
@simolus3
simolus3 merged commit 9be90b3 into main Oct 28, 2026
15 of 20 checks passed
@simolus3
simolus3 deleted the fix-tx-rollback branch October 28, 2026 08:36
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.

Rejected COMMIT finalizes transaction handle before rollback, leaving native writer open

2 participants