Skip to content

Conversation

@pandeykushagra51
Copy link

@pandeykushagra51 pandeykushagra51 commented Nov 17, 2025

added support for trigger and index migration during snapshot and polling to periodically fetch trigger and index updates.

Implementation Details:

  1. Implemented trigger and schema migration where following operation will be done:
    a. During initial migration (snapshot), the triggers and function will be fetched from source pg table and applied to dest table.
    b. There will be periodically scan of triggers on src at interval of 1 min and the updated triggers will be applied to destination table.

Triggers are created disabled on the destination to prevent double execution. If a source trigger increments a counter on UPDATE, the change replicates to the destination. If the destination trigger is enabled, it runs again and increments the counter twice, causing incorrect values. Since data changes come from replication, not local operations, enabling triggers would duplicate side effects. Keeping them disabled ensures the destination matches the source without extra trigger logic. Enable them only if the destination needs its own separate trigger behavior.

The plan is to make polling of trigger and index make it configurable through UI.
Polling was choosen as updating trigger and index with some delay will not break any think (as data is already written immediately so updating trigger with delay doesn't impact.)

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@pandeykushagra51
Copy link
Author

@serprex serprex requested a review from iskakaushik November 18, 2025 00:17
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.

3 participants