Chris Browne cbbrowne at lists.slony.info
Mon Feb 5 14:18:08 PST 2007
Update of /home/cvsd/slony1/slony1-engine/src/backend
In directory main:/tmp/cvs-serv3368/src/backend

Modified Files:
      Tag: REL_1_1_STABLE
	slony1_funcs.sql 
Log Message:
Apply bug fix for #1538 to 1.1 branch (already in place in 1.2, HEAD).

This is for the case where a cluster only has one node; in that case,
the cleanup loop wouldn't clear out old events and would never clear
sl_log_[12] until you added a node back in.


Index: slony1_funcs.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.sql,v
retrieving revision 1.64.2.19
retrieving revision 1.64.2.20
diff -C2 -d -r1.64.2.19 -r1.64.2.20
*** slony1_funcs.sql	1 Nov 2006 22:13:05 -0000	1.64.2.19
--- slony1_funcs.sql	5 Feb 2007 22:18:06 -0000	1.64.2.20
***************
*** 4285,4288 ****
--- 4285,4307 ----
  
  	-- ----
+ 	-- If cluster has only one node, then remove all events up to
+ 	-- the last SYNC - Bug #1538
+ 	-- http://gborg.postgresql.org/project/slony1/bugs/bugupdate.php?1538
+ 	-- ----
+ 
+ 	select * into v_min_row from @NAMESPACE at .sl_node where
+ 			no_id <> @NAMESPACE at .getLocalNodeId(''_ at CLUSTERNAME@'') limit 1;
+ 	if not found then
+ 		select ev_origin, ev_seqno into v_min_row from @NAMESPACE at .sl_event
+ 		where ev_origin = @NAMESPACE at .getLocalNodeId(''_ at CLUSTERNAME@'')
+ 		order by ev_origin desc, ev_seqno desc limit 1;
+ 		raise notice ''Slony-I: cleanupEvent(): Single node - deleting events < %'', v_min_row.ev_seqno;
+ 			delete from @NAMESPACE at .sl_event
+ 			where
+ 				ev_origin = v_min_row.ev_origin and
+ 				ev_seqno < v_min_row.ev_seqno;
+ 
+ 	end if;
+ 	-- ----
  	-- Also remove stale entries from the nodelock table.
  	-- ----




More information about the Slony1-commit mailing list