[Bucardo-general] swap sync action: source to source in 4.8

Alexey Klyukin porkbird at me.com
Fri Jul 20 07:02:43 UTC 2012


I've been reading the source code of Bucardo 4.8 recently (to deepen my understanding of how it works) and came across the following comment in a section that deals with the swap sync:

## Go through all keys and resolve any conflicts. Bitmap action:
               ## 1 = Add source row to the target db
               ## 2 = Add target row to the source db
               ## 4 = Add source row to the source db
               ## 8 = Add target row to the target db

Later, throughout the code, there is full support for actions 4 and 8, although one can only trigger them from the custom conflict handler, as standard ones only produce 1 and 2. Per my understanding, these actions are mostly no-op, for delete they delete non-existant rows from the source or target databases (cause they were already deleted), for non-deletes they just update the rows on source/target with exactly the same values, increasing the table's bloat. Also, if the sync is set to 'makedelta', then these actions would also duplicate rows in the corresponding delta tables, but with the more recent timestamps.  

Since the row is not replicated to another DB I'm wondering if these are 'skip' actions, i.e. those to not replicate the conflicting row.

Is there a real-world example that makes replication useful for 'source to source' and 'target to target' actions?

BTW, there seem to be no support for the truncate for swap replication (i.e. truncate will do nothing), although the swap sync will be kicked by the on truncate trigger. Am I understanding this correctly?

Thank you,

More information about the Bucardo-general mailing list