[Bucardo-general] Replication problems? data overwritten?

eric machine eric.machine at hotmail.com
Fri Aug 23 14:30:55 UTC 2013


Hi everyone,
I need help here.
I am currently using this version https://github.com/bucardo/bucardo
Basically, I will have branch sync data to HQ.
My replication works fine, no more error on primary key after i exclude the nopk-table.
I tried these commands below.
bucardo installbucardo add database dbleft dbname=branchdbbucardo add database dbright host=192.168.1.12 dbname=hqdbbucardo add all tables -T nopk-table herd=therdbucardo add all sequences herd=therdbucardo add dbgroup tgroup dbleft:source dbright:targetbucardo add sync foobar herd=therd dbs=tgroup ping=falsebucardo startbucardo kick foobarbucardo statusbucardo stopbucardo start
Now I have a new problem. I have no idea how to solve this. 
FYI, project table has only 1 primary key which is ID. UserID is the foreign key. Note, I am using an open source system which has the db design. If I change the db design, I will screw up the whole system.
Branch - project table------------------------------ID | UserID | Project---------------------------1   | John     | A2   | John     | B3   | John     | C
HQ - project table------------------------ID | UserID | Project---------------------------1   | Susan     | X2   | Susan     | Y
When I sync branch to HQ, then I will have the latest results as below.
HQ - project table------------------------------ID | UserID | Project---------------------------1   | John     | A2   | John     | B3   | John     | C
How come Susan's data are all gone? It's all overwritten by John? I believe it is due to the same primary key which probably Bucardo updates them. Is there a way when replication from branch to HQ for this project table, it will auto-increment new ID instead of replacing them? Or based on ID and UserID?
By right, I should have these data for HQ.
HQ - project table (but i doubt this will work due to ID as the only pk)------------------------------ID | UserID | Project---------------------------1   | John     | A1   | Susan   | X2   | John     | B2   | Susan   | Y3   | John     | C
or at least this
HQ - project table------------------------------ID | UserID | Project---------------------------1   | John     | A2   | John     | B3   | John     | C4   | Susan   | X5   | Susan   | Y
But I need to do some kind of real time replication sync? else, I am not sure how does bucardo smart enough to assign 4 and 5 to susan.
Note: RubyReps doesn't have this problem. Why? When you enable streaming replication, for dbleft the primary key will be auto-increment based on odd number. For dbright, it will auto increment on even number. Just I can't figure out how-to solve this on bucardo 5.
Any help? Thanks in advance.
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.endcrypt.com/pipermail/bucardo-general/attachments/20130823/0e0e6672/attachment.html>


More information about the Bucardo-general mailing list