Hi Debezium community,
I have a question regarding a bidirectional replication scenario between PostgreSQL and Oracle (covering PG<->Oracle, PG<->PG, and Oracle<->PG).
I am trying to implement a topology where column ownership is split between the source and the sink side to avoid full conflict resolution, but I am concerned about infinite loops.
Here is the specific scenario:
Table Structure: Both Source and Sink tables have columns ColA through ColG.
Source to Sink Flow: The source application updates ColA ~ ColF. These changes are replicated to the Sink.
Sink Side Logic: A specific service on the sink side only updates ColG.
Sink to Source Flow: The update on ColG at the Sink needs to be replicated back to the Source's ColG.
My Questions:
Is this bidirectional pattern (split column ownership) achievable with Debezium source/sink connectors?
Loop Prevention: Since the update of ColG on the Sink will generate a change event, how can I prevent the "echo" or infinite loop where this event travels back to the Source, and potentially triggers another update for ColA~ColF?
Are there any specific configurations (e.g., using SMTs like Filter, or checking transaction metadata) recommended for this partial update scenario?
Thanks in advance for your help!
--
You received this message because you are subscribed to the Google Groups "debezium" group.
To unsubscribe from this group and stop receiving emails from it, send an email to debezium+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/debezium/9414efa8-1c43-4f87-b7e6-492f0a09cfc6n%40googlegroups.com.
Hi Chris,
Thank you for the detailed recommendations!
After reviewing the options, I decided to implement a simplified architecture using a Flag column (msk_flag) and Triggers to avoid the complexity of developing a custom SMT. This approach effectively prevents infinite loops while achieving bidirectional synchronization.
Here is a summary of the implemented data flow:
Forward Flow (Source -> Target):
Any change in the Source DB is published to MSK Topic ①.
When the Sink Connector applies this change to the Target DB, it explicitly sets the msk_flag to FALSE. This signifies the end of the replication cycle for that event.
Reverse Flow (Target -> Source):
If a user or service on the Target side needs to push an update back, they must set msk_flag to TRUE.
A DB Trigger on the Target table detects the TRUE status and records the change into a separate log table (_dml_msk).
This log is published to MSK Topic ②, which then flows into a queue table (_dml_queue) on the Source side. A final trigger on the Source DB applies the data back to the main table.
Loop Prevention Logic:
The infinite loop is avoided because the Sink Connector always forces msk_flag to FALSE during its write operation. Since the reverse flow trigger only activates when the flag is TRUE, the "echo" back to the source is never triggered by replicated events.
This allows us to handle partial column ownership (A~F for Source, G for Sink) without the risk of circular updates.
Thanks again for your support! It helped me refine the final design.
Best regards, Hyojin