}, undef, $x->{DBGROUPNAME});
$self->glog("Signalling all other syncs that this table has changed", LOG_DEBUG);
- $SQL = 'SELECT sync FROM bucardo.bucardo_delta_names WHERE sync <> ? AND tablename = ?';
- $sth = $dbh->prepare($SQL);
- $count = $sth->execute($syncname,$tname);
- for my $row (@{ $sth->fetchall_arrayref }) {
+ ## Cache this
+ if (! exists $self->{kick_othersyncs}{$syncname}{$tname}) {
+ $SQL = 'SELECT sync FROM bucardo.bucardo_delta_names WHERE sync <> ? AND tablename = ?';
+ $sth = $dbh->prepare($SQL);
+ $count = $sth->execute($syncname,$tname);
+ $self->{kick_othersyncs}{$syncname}{$tname} = $sth->fetchall_arrayref();
+ }
+ for my $row (@{ $self->{kick_othersyncs}{$syncname}{$tname} }) {
my $othersync = $row->[0];
$self->db_notify($dbh, "kick_sync_$othersync");
}
qr/Added sync "deltatest1"/, 'Create sync "deltatest1"';
# Create a sync for replication from B to C
-like $bct->ctl('bucardo add sync deltatest2 relgroup=myrels dbs=B,C'),
+like $bct->ctl('bucardo add sync deltatest2 relgroup=myrels dbs=B,C autokick=no'),
qr/Added sync "deltatest2"/, 'Create sync "deltatest2"';
# Listen in on things.
ok $bct->restart_bucardo($dbhX), 'Bucardo should start';
ok $bct->wait_for_notice($dbhX, [qw(
bucardo_syncdone_deltatest1
- bucardo_syncdone_deltatest2
-)]), 'The deltatest1 and deltatest2 syncs should finish';
+)]), 'The deltatest1 sync finished';
# Should have no rows.
$bct->check_for_row([], [qw(A B C)], undef, 'test[124]$');
'Insert a row into test1 on A';
$dbhA->commit;
+## Bucardo will fire off deltatest2 itself
ok $bct->wait_for_notice($dbhX, [qw(
bucardo_syncdone_deltatest1
bucardo_syncdone_deltatest2
)]), 'The deltatest1 and deltatest2 syncs have finished';
+
# The row should be in A and B, as well as C!
is_deeply $dbhB->selectall_arrayref(
'SELECT id, data1 FROM bucardo_test1'
'Insert a row into test2 on B';
$dbhB->commit;
+## Sync deltatest2 is not automatic, so we need to kick it
+# Kick off the second sync
+$bct->ctl('bucardo kick sync deltatest2 0');
+
ok $bct->wait_for_notice($dbhX, [qw(
bucardo_syncdone_deltatest1
bucardo_syncdone_deltatest2