Revert "Make kick triggers consistently use the non-payload version."
authorDavid E. Wheeler <david@justatheory.com>
Wed, 24 Jul 2013 17:23:16 +0000 (19:23 +0200)
committerDavid E. Wheeler <david@justatheory.com>
Wed, 24 Jul 2013 17:23:16 +0000 (19:23 +0200)
This reverts commit 25973f4b5ba797568467632b79e8129ffe007f49. I'm pretty sure
this was not the problem, since I have syncs that *do* work with this
approach.

The problem I'm having with a NOTIFY being ignored is that the database in
question is used in two db groups, once as a source, another as a target. As
it validates, it finds the target record before the source, and stores that
one away. Then the autokick is ignored, because Bucardo thinks the DB is a
target, not a source. Working on a fix for that now.

Bucardo.pm
bucardo.schema

index 906ce85acb8c9a158888321951877cf8608973fb..ee20796572865373078c0ec407c41e528dff4338 100644 (file)
@@ -6344,7 +6344,7 @@ sub validate_sync {
             $x = $self->{sdb}{$dbname};
             next if $x->{role} ne 'source';
 
-            $self->db_listen($x->{dbh}, $l, $dbname, 1);
+            $self->db_listen($x->{dbh}, $l, $dbname, 0);
             $x->{dbh}->commit();
         }
     }
@@ -6453,7 +6453,7 @@ sub deactivate_sync {
         $x->{dbh}->commit();
         if ($s->{autokick}) {
             my $l = "kick_sync_$syncname";
-            $self->db_unlisten($x->{dbh}, $l, $dbname, 1);
+            $self->db_unlisten($x->{dbh}, $l, $dbname, 0);
             $x->{dbh}->commit();
         }
     }
index d21744f76a709cf1b1fab8f3ac93c7d9ad624315..8b30558a0f3f3bd9af4becf4b5269695ddce66cf 100644 (file)
@@ -1387,7 +1387,9 @@ for my $dbname (sort { ($db{$b}{role} eq 'source') <=> ($db{$a}{role} eq 'source
         if ($newschema || $count < 1) {
             ## We may override this later on with a custom function from bucardo_custom_trigger
             ## and we may not even use it all, but no harm in creating the stock one here
-            my $notice = qq{"bucardo_kick_sync_$syncname"};
+            my $notice = $dbh->{pg_server_version} >= 90000
+                ? qq{bucardo, 'kick_sync_$syncname'}
+                : qq{"bucardo_kick_sync_$syncname"};
             $SQL = qq{
                   CREATE OR REPLACE FUNCTION bucardo."$kickfunc"()
                   RETURNS TRIGGER