Jan Wieck wieck at lists.slony.info
Mon Mar 23 08:30:20 PDT 2009
Update of /home/cvsd/slony1/slony1-engine/src/backend
In directory main.slony.info:/tmp/cvs-serv30765/src/backend

Modified Files:
      Tag: REL_1_2_STABLE
	slony1_funcs.sql 
Log Message:
Fixed some broken logic in failedNode()

It apparently never supported failing over to nodes that are not
a direct subscriber to the failed node. 


Jan


Index: slony1_funcs.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.sql,v
retrieving revision 1.98.2.32
retrieving revision 1.98.2.33
diff -C2 -d -r1.98.2.32 -r1.98.2.33
*** slony1_funcs.sql	5 Mar 2009 22:37:23 -0000	1.98.2.32
--- slony1_funcs.sql	23 Mar 2009 15:30:18 -0000	1.98.2.33
***************
*** 1243,1249 ****
  			raise notice ''failedNode: set % has other direct receivers - change providers only'', v_row.set_id;
  			-- ----
! 			-- Backup node is not the only direct subscriber. This
! 			-- means that at this moment, we redirect all direct
! 			-- subscribers to receive from the backup node, and the
  			-- backup node itself to receive from another one.
  			-- The admin utility will wait for the slon engine to
--- 1243,1250 ----
  			raise notice ''failedNode: set % has other direct receivers - change providers only'', v_row.set_id;
  			-- ----
! 			-- Backup node is not the only direct subscriber or not
! 			-- a direct subscriber at all. 
! 			-- This means that at this moment, we redirect all possible
! 			-- direct subscribers to receive from the backup node, and the
  			-- backup node itself to receive from another one.
  			-- The admin utility will wait for the slon engine to
***************
*** 1256,1269 ****
  							from @NAMESPACE at .sl_subscribe SS
  							where SS.sub_set = v_row.set_id
- 								and SS.sub_provider = p_failed_node
  								and SS.sub_receiver <> p_backup_node
! 								and SS.sub_forward)
  					where sub_set = v_row.set_id
  						and sub_receiver = p_backup_node;
  			update @NAMESPACE at .sl_subscribe
! 					set sub_provider = p_backup_node
  					where sub_set = v_row.set_id
- 						and sub_provider = p_failed_node
  						and sub_receiver <> p_backup_node;
  		end if;
  	end loop;
--- 1257,1291 ----
  							from @NAMESPACE at .sl_subscribe SS
  							where SS.sub_set = v_row.set_id
  								and SS.sub_receiver <> p_backup_node
! 								and SS.sub_forward
! 								and exists (
! 									select 1 from @NAMESPACE at .sl_path
! 										where pa_server = SS.sub_receiver
! 										  and pa_client = p_backup_node
! 								))
  					where sub_set = v_row.set_id
  						and sub_receiver = p_backup_node;
  			update @NAMESPACE at .sl_subscribe
! 					set sub_provider = (select min(SS.sub_receiver)
! 							from @NAMESPACE at .sl_subscribe SS
! 							where SS.sub_set = v_row.set_id
! 								and SS.sub_receiver <> p_failed_node
! 								and SS.sub_forward
! 								and exists (
! 									select 1 from @NAMESPACE at .sl_path
! 										where pa_server = SS.sub_receiver
! 										  and pa_client = @NAMESPACE at .sl_subscribe.sub_receiver
! 								))
  					where sub_set = v_row.set_id
  						and sub_receiver <> p_backup_node;
+ 			update @NAMESPACE at .sl_subscribe
+ 					set sub_provider = p_backup_node
+ 					where sub_set = v_row.set_id
+ 						and sub_receiver <> p_backup_node
+ 						and exists (
+ 							select 1 from @NAMESPACE at .sl_path
+ 								where pa_server = p_backup_node
+ 								  and pa_client = @NAMESPACE at .sl_subscribe.sub_receiver
+ 						);
  		end if;
  	end loop;



More information about the Slony1-commit mailing list