Skip to content

Added manageDestinationExternally option to diff trigger creation. #881

Open
Chriztiaan wants to merge 14 commits intomainfrom
feature/persisted-diff-trigger-destination
Open

Added manageDestinationExternally option to diff trigger creation. #881
Chriztiaan wants to merge 14 commits intomainfrom
feature/persisted-diff-trigger-destination

Conversation

@Chriztiaan
Copy link
Contributor

@Chriztiaan Chriztiaan commented Mar 5, 2026

As part of the TanstackDB on-demand mode implementation we constantly re-invoke createDiffTrigger() on the same destination table and dispose the stale version as the target clause changes. Every invocation of the update flow (dispose existing+create new) causes the table destination be dropped and recreated, which left potential gaps which couldn't be covered without locks.

With the introduction of the manageDestinationExternally option we can opt out of the create/dispose lifecycle of createDiffTrigger for the destination table and allow the user to manually manage those parts. To circumvent the automatic cleanup flow for triggers registered with this new option, which happens if a trigger has no claims - we register the trigger with a different name-pattern which causes a miss on the regex for the automatic cleanup flow.

…e destination table to be persisted beyond cleanup of a trigger, also allows the creation to complete even if the destination table already exists.
@changeset-bot
Copy link

changeset-bot bot commented Mar 5, 2026

🦋 Changeset detected

Latest commit: 3ccc8e3

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

This PR includes changesets to release 8 packages
Name Type
@powersync/common Minor
@powersync/adapter-sql-js Patch
@powersync/node Patch
@powersync/op-sqlite 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

@Chriztiaan Chriztiaan changed the title Added persistDestination option to diff trigger creation. Added manageDestinationExternally option to diff trigger creation. Mar 5, 2026
@Chriztiaan Chriztiaan force-pushed the feature/persisted-diff-trigger-destination branch from aff4d8b to 49f564f Compare March 5, 2026 12:30
…l internal management of the destination table.
@Chriztiaan Chriztiaan force-pushed the feature/persisted-diff-trigger-destination branch from 49f564f to 8e501da Compare March 5, 2026 12:32
@Chriztiaan Chriztiaan marked this pull request as ready for review March 5, 2026 13:45
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