bdr: Fix bdr.do_not_replicate implementation.
authorAndres Freund <andres@anarazel.de>
Thu, 12 Feb 2015 17:59:16 +0000 (18:59 +0100)
committerAndres Freund <andres@anarazel.de>
Thu, 12 Feb 2015 18:03:04 +0000 (19:03 +0100)
Luckily the only consequence of the borked implementation was that
pg_get_replication_identifier_progress() failed with an assertion
failure. There was no problem with replaying those changes because the
other nodes aren't allowed to connect at that point.

bdr.c
bdr_replication_identifier.c

diff --git a/bdr.c b/bdr.c
index 0f106203286acbc61ecf28e437462c2bc610d5b0..8410f59a3fe2f09e1ac9e34393569929474f1714 100644 (file)
--- a/bdr.c
+++ b/bdr.c
@@ -616,11 +616,11 @@ bdr_do_not_replicate_check_hook(bool *newvalue, void **extra, GucSource source)
 static void
 bdr_do_not_replicate_assign_hook(bool newvalue, void *extra)
 {
+   /* Mark these transactions as not to be replicated to other nodes */
    if (newvalue)
-   {
-       /* Mark these transactions as not to be replicated to other nodes */
-       SetupCachedReplicationIdentifier(DoNotReplicateRepNodeId);
-   }
+       replication_origin_id = DoNotReplicateRepNodeId;
+   else
+       replication_origin_id = InvalidRepNodeId;
 }
 
 
index bb929aa0226653b36ad432b6746504e5e7b1bac4..7c3870e75aeca8d4411d1fd606937953a5cd6fb9 100644 (file)
@@ -404,6 +404,9 @@ SetupCachedReplicationIdentifier(RepNodeId node)
    XLogRecPtr      remote_lsn = InvalidXLogRecPtr,
                    local_lsn = InvalidXLogRecPtr;
 
+   Assert(node != DoNotReplicateRepNodeId);
+   Assert(node != InvalidRepNodeId);
+
    if (local_replication_state != NULL)
        ereport(ERROR,
                (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),