CVS User Account cvsuser
Wed Sep 13 15:42:12 PDT 2006
Log Message:
-----------
Adjust the sl_setsync row of moved sets to the correct values
for ssy_seqno, ssy_minxid, ssy_maxxid and ssy_xip when processing
ACCEPT_SET. Setsync must represent the transaction status before
the first change could happen on the new origin.

Jan

Modified Files:
--------------
    slony1-engine/src/backend:
        slony1_funcs.sql (r1.95 -> r1.96)
    slony1-engine/src/slon:
        remote_worker.c (r1.121 -> r1.122)

-------------- next part --------------
Index: slony1_funcs.sql
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/backend/slony1_funcs.sql,v
retrieving revision 1.95
retrieving revision 1.96
diff -Lsrc/backend/slony1_funcs.sql -Lsrc/backend/slony1_funcs.sql -u -w -r1.95 -r1.96
--- src/backend/slony1_funcs.sql
+++ src/backend/slony1_funcs.sql
@@ -2217,7 +2217,11 @@
 
 	-- On the new origin, raise an event - ACCEPT_SET
 	if v_local_node_id = p_new_origin then
-		
+		-- Create a SYNC event as well so that the ACCEPT_SET has
+		-- the same snapshot as the last SYNC generated by the new
+		-- origin. This snapshot will be used bu other nodes to
+		-- finalize the setsync status.
+		perform @NAMESPACE at .createEvent(''_ at CLUSTERNAME@'', ''SYNC'', NULL);
 		perform @NAMESPACE at .createEvent(''_ at CLUSTERNAME@'', ''ACCEPT_SET'', 
 			p_set_id, p_old_origin, p_new_origin);
 	end if;
Index: remote_worker.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/remote_worker.c,v
retrieving revision 1.121
retrieving revision 1.122
diff -Lsrc/slon/remote_worker.c -Lsrc/slon/remote_worker.c -u -w -r1.121 -r1.122
--- src/slon/remote_worker.c
+++ src/slon/remote_worker.c
@@ -1176,14 +1176,37 @@
 						res = PQexec(local_dbconn, dstring_data(&query2));
 					}
 					PQclear(res);
-					slon_log(SLON_DEBUG2, "ACCEPT_SET - MOVE_SET or FAILOVER_SET exists - done\n");
+					slon_log(SLON_DEBUG2, "ACCEPT_SET - MOVE_SET or FAILOVER_SET exists - adjusting setsync status\n");
 
+					/*
+					 * Finalize the setsync status to mave the ACCEPT_SET's
+					 * seqno and snapshot info.
+					 */
+					slon_appendquery(&query1,
+								"update %s.sl_setsync "
+								"    set ssy_seqno = '%s', "
+								"        ssy_minxid = '%s', "
+								"        ssy_maxxid = '%s', "
+								"        ssy_xip = '%q', "
+								"        ssy_action_list = '' "
+								"    where ssy_setid = %d; ",
+								rtcfg_namespace,
+								seqbuf,
+								event->ev_minxid_c,
+								event->ev_maxxid_c,
+								event->ev_xip,
+								set_id);
+
+					/*
+					 * Execute all queries and restart slon.
+					 */
 					slon_appendquery(&query1,
 									 "notify \"_%s_Restart\"; ",
 									 rtcfg_cluster_name);
 					query_append_event(&query1, event);
 					slon_appendquery(&query1, "commit transaction;");
 					query_execute(node, local_dbconn, &query1);
+					slon_log(SLON_DEBUG2, "ACCEPT_SET - done\n");
 					slon_retry();
 
 					need_reloadListen = true;



More information about the Slony1-commit mailing list