[Bucardo-general] Swap replication latency

Alex Balashov abalashov at evaristesys.com
Wed May 4 16:34:35 UTC 2011

Now here's a question, which in retrospect seems quite obvious, but I 
didn't even think to ask it.

We have several scenarios in our database where raw data is inserted 
into one type of table, and AFTER INSERT OR UPDATE triggers attached 
to that table process the raw data and turn it into a row in another 
table.  This is mainly needed to process many call accounting events 
associated with one transaction into a single call detail record. 
It's ugly but is an adaptation layer needed to support the application.

The stored procedures and triggers are built on both copies of the 

How does Bucardo deal with this?  I am realising just now that it may 
not.  Let's say I have table 'evariste_trans_events' on which a 
trigger cascade operates to turn it into single 'evariste_trans' rows. 
  The normal way this happens on the source database is that the 
application inserts rows into 'evariste_trans_events', and triggers 
machine that data into the appropriate representation in 
'evariste_trans' as needed.  Most of the time, 'evariste_trans' will 
be UPDATE'd based on subsequent 'evariste_trans_events', although the 
initial event will cause an INSERT.

Because I do not know how the Postgres meta-level trigger / change 
event listeners that Bucardo uses work, I have no idea if it is aware 
of this scenario, or if it would simply mimic the row-level changes it 
sees in both 'evariste_trans_events' and 'evariste_trans'.  If so, 
that probably explains all of our problems and failures, and the 
proper thing to do would be to take all the final destination tables 
out of replication so that they can be populated via the change 
statements in the intermediate tables, via the existing trigger route.

(If this were master-slave, we could just unattach all triggers, but 
it's swap.)

Any insights or clarifications appreciated.

Alex Balashov - Principal
Evariste Systems LLC
260 Peachtree Street NW
Suite 2200
Atlanta, GA 30303
Tel: +1-678-954-0670
Fax: +1-404-961-1892
Web: http://www.evaristesys.com/

More information about the Bucardo-general mailing list