CVS User Account cvsuser
Wed Jul 13 20:47:57 PDT 2005
Log Message:
-----------
Resolve bug #1362

Change subscribeset() to verify that the provider is either:
 a) The origin for the set, or
 b) An active forwarding subscriber for the set

The observed result was...

-----------------------------------------------------------------------
I have a cluster replicating several sets, and yesterday I tried to add
yet another node to it and to subscribe the new node to get set5 from
"node3" which was subscribing to the master node "node1".

I noticed that node3 was subscribing with forward=no, so I made a small
slonik script to set subscription to forward=yes. unfortunately I made a
small typo (or maybe a thinko) and also wrote the set id (5) as
provider, so that instead of subscribing to node1, node3 was now
subscribing to node5, which did not even have any of the tables in set5.

Later, when I noticed my mistake, I changed the provider back
to node1, but I'm now missing the changes that had happened in between.
-----------------------------------------------------------------------

Modified Files:
--------------
    slony1-engine/src/backend:
        slony1_funcs.sql (r1.64 -> r1.65)

-------------- next part --------------
Index: slony1_funcs.sql
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/backend/slony1_funcs.sql,v
retrieving revision 1.64
retrieving revision 1.65
diff -Lsrc/backend/slony1_funcs.sql -Lsrc/backend/slony1_funcs.sql -u -w -r1.64 -r1.65
--- src/backend/slony1_funcs.sql
+++ src/backend/slony1_funcs.sql
@@ -3784,6 +3784,7 @@
 	p_sub_forward		alias for $4;
 	v_set_origin		int4;
 	v_ev_seqno			int8;
+	v_rec			record;
 begin
 	-- ----
 	-- Grab the central configuration lock
@@ -3815,6 +3816,19 @@
 				''Slony-I: set provider and receiver cannot be identical'';
 	end if;
 
+	-- ---
+	-- Verify that the provider is either the origin or an active subscriber
+	-- Bug report #1362
+	-- ---
+	if v_set_origin <> p_sub_provider then
+		select 1 into v_rec from @NAMESPACE at .sl_subscribe
+			where sub_set = p_sub_set and 
+                              sub_receiver = p_sub_provider and
+			      sub_forward and sub_active;
+		if not found then
+			raise exception ''Slony-I: provider % is not an active forwarding node for replication set %'', p_sub_provider, p_sub_set;
+		end if;
+	end if;
 
 	-- ---
 	-- Check to see if the set contains any tables - gripe if not - bug #1226


More information about the Slony1-commit mailing list