[Bucardo-general] Syncs are aborted if one of the involved DBs is offline

José Montero jose.montero at brain-tec.ch
Fri Apr 5 14:42:29 UTC 2013


Hello everyone,

A client of my company needs a multi-master replication mechanism for 
PostgreSQL and I have been suggested to use Bucardo. I know the stable 
version of Bucardo doesn't allow multi-master replication, but the beta 
version 5 does.

I have tested the way Bucardo 5 performs syncs and it looks nice. 
However, I've encountered a major problem that, according to what I've 
read in forums, may be an implementation decision:

    *A sync is aborted if one of the involved DBs is offline. *

My client needs to replicate data among more than 20 nodes. 
Statistically, it is almost impossible that the 20 nodes will be online 
simultaneously. Therefore, I really need a sync to synchronize "now" as 
many databases as possible and later, when the offline databases come 
online, to synchronize them. Is there a way to achieve what I need using 
the current version of Bucardo (4.99.7)?

Maybe if I define syncs in a different way, will they behave as 
expected? My bucardo database is populated as follows:

INSERT INTO db (name, dbname, dbhost, dbuser, dbpass) VALUES 
('bucardo_land', 'gp_bucardo', 'xxx', 'bucardo', 'xxx');
INSERT INTO db (name, dbname, dbhost, dbuser, dbpass) VALUES 
('bucardo_ship_1', 'gp_bucardo', 'xxx', 'bucardo', 'xxx');
INSERT INTO db (name, dbname, dbhost, dbuser, dbpass) VALUES 
('bucardo_ship_2', 'gp_bucardo', 'xxx', 'bucardo', 'xxx');
INSERT INTO db (name, dbname, dbhost, dbuser, dbpass) VALUES 
('bucardo_ship_3', 'gp_bucardo', 'xxx', 'bucardo', 'xxx');
INSERT INTO db (name, dbname, dbhost, dbuser, dbpass) VALUES 
('bucardo_ship_4', 'gp_bucardo', 'xxx', 'bucardo', 'xxx');
...more bucardo_ships...

INSERT INTO dbgroup (name) VALUES ('dg_land2ship');

INSERT INTO dbmap (dbgroup, db, role) VALUES('dg_land2ship', 
'bucardo_land', 'source');
INSERT INTO dbmap (dbgroup, db, role) VALUES('dg_land2ship', 
'bucardo_ship_1', 'target');
INSERT INTO dbmap (dbgroup, db, role) VALUES('dg_land2ship', 
'bucardo_ship_2', 'target');
INSERT INTO dbmap (dbgroup, db, role) VALUES('dg_land2ship', 
'bucardo_ship_3', 'target');
INSERT INTO dbmap (dbgroup, db, role) VALUES('dg_land2ship', 
'bucardo_ship_4', 'target');
...more bucardo_ships...

INSERT INTO goat (db, schemaname, tablename, reltype, conflict_strategy) 
VALUES ('bucardo_land', 'public', 'res_lang', 'table', 'latest');
INSERT INTO goat (db, schemaname, tablename, reltype, conflict_strategy) 
VALUES ('bucardo_land', 'public', 'res_country', 'table', 'latest');
INSERT INTO goat (db, schemaname, tablename, reltype, conflict_strategy) 
VALUES ('bucardo_land', 'public', 'res_country_state', 'table', 'latest');
INSERT INTO goat (db, schemaname, tablename, reltype, conflict_strategy) 
VALUES ('bucardo_land', 'public', 'res_currency', 'table', 'latest');
INSERT INTO goat (db, schemaname, tablename, reltype, conflict_strategy) 
VALUES ('bucardo_land', 'public', 'res_partner', 'table', 'latest');
INSERT INTO goat (db, schemaname, tablename, reltype, conflict_strategy) 
VALUES ('bucardo_land', 'public', 'res_partner_address', 'table', 'latest');
INSERT INTO goat (db, schemaname, tablename, reltype, conflict_strategy) 
VALUES ('bucardo_land', 'public', 'res_partner_bank', 'table', 'latest');

INSERT INTO herd (name) VALUES ('h_res');
INSERT INTO herdmap (herd, goat) SELECT 'h_res', id FROM goat WHERE 
tablename='res_lang';
INSERT INTO herdmap (herd, goat) SELECT 'h_res', id FROM goat WHERE 
tablename='res_country';
INSERT INTO herdmap (herd, goat) SELECT 'h_res', id FROM goat WHERE 
tablename='res_country_state';
INSERT INTO herdmap (herd, goat) SELECT 'h_res', id FROM goat WHERE 
tablename='res_currency';
INSERT INTO herdmap (herd, goat) SELECT 'h_res', id FROM goat WHERE 
tablename='res_partner';
INSERT INTO herdmap (herd, goat) SELECT 'h_res', id FROM goat WHERE 
tablename='res_partner_address';
INSERT INTO herdmap (herd, goat) SELECT 'h_res', id FROM goat WHERE 
tablename='res_partner_bank';
INSERT INTO sync (name, herd, dbs, status) VALUES('s_res', 'h_res', 
'dg_land2ship', 'active');

If I make a change in the "res_lang" table in the "bucardo_land" node:

  * If all the bucardo_ships are online, all bucardo_ships are updated.
  * If one bucardo_ship is offline, no bucardo_ship is updated. Taking
    into account that one bucardo_ship will be normally offline, no
    update will ever occur.

I've been having a look at the "Bucardo.pm" file and "fixing" the 
problem I describe is not straighforward. But I can try to "fix" it if 
you think it is feasible (I'm no expert in Perl, but I have quite a lot 
of experience in Python).

Thank you very much in advance for any help you can give me.

Best regards,

José Montero
Bsc in Computer Engineering
Bsc Master in Computer Science

brain-tec AG
IT-Solutions
Überlandstrasse 10
CH-3900 Brig

www.brain-tec.ch <http://www.brain-tec.ch>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.endcrypt.com/pipermail/bucardo-general/attachments/20130405/228eb0b9/attachment.html>


More information about the Bucardo-general mailing list