Bucardo 5 Cascaded Slave Replication

When I read new release of Bucardo 5 with capability of asynchronous multi-master replication, I was eagered to wet my foot before swimming. Not really about multi-master features, just to implement simple master-slave-cascaded_slave replication, as I have done with Slony.

Scenario:
master table A => slave table B => cascaded slave table C.

So, I built Bucardo from source version 5.1.1 then configured databases, tables, syncs. I have turned on “makedelta” for slave table which is source for cascaded replication to another slave table. Master to slave (A to B) replication run well. But, unfortunately, the cascaded replication (B to C) does not work.

Then I dig into Bucardo.pm source code. In sub start_kid, the “does_makedelta hash” populated as follows:

sub start_kid {


for my $dbname (@dbs_source) {

$x = $sync->{db}{$dbname};

for my $g (@$goatlist) {


## Set the per database/per table makedelta setting now
if (defined $g->{makedelta}) {

if ($g->{makedelta} eq ‘on’ or $g->{makedelta} =~ /\b$dbname\b/) {

$x->{does_makedelta}{$S}{$T} = 1;

}

}

}

}

}

I suspect that “does_makedelta hash” reference was incorrectly taken from dbs_source. To my opinion, it should be taken from dbs_target. So, I move “does_makedelta hash” to another new dbs_target loop:

sub start_kid {


for my $dbname (@dbs_source) {

$x = $sync->{db}{$dbname};

for my $g (@$goatlist) {


## Set the per database/per table makedelta setting now
## if (defined $g->{makedelta}) {

## if ($g->{makedelta} eq ‘on’ or $g->{makedelta} =~ /\b$dbname\b/) {

## $x->{does_makedelta}{$S}{$T} = 1;
## …

## }

## }

}

}

for my $dbname (@dbs_target) {

$x = $sync->{db}{$dbname};
for my $g (@$goatlist) {

next if $g->{reltype} ne ‘table';
($S,$T) = ($g->{safeschema},$g->{safetable});
## Set the per database/per table makedelta setting now
if (defined $g->{makedelta}) {

if ($g->{makedelta} eq ‘on’ or $g->{makedelta} =~ /\b$dbname\b/) {

$x->{does_makedelta}{$S}{$T} = 1;
$self->glog(“Set table $dbname.$S.$T to makedelta”, LOG_NORMAL);

}

}

}

}

}

I have not verified whether it was valid. But, at least, my cascaded replication works.

About these ads
3 comments
  1. Nice Experiment sir. Keep sharing about knowledge.

  2. It should be for both source *and* targets. Thanks for spotting the problem. Should be fixed as of f1bde730baf51782aea5ca196f8412ef4c731613

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: