unsubscribe_abandoned_sets(p_failed_node integer)

8.133. unsubscribe_abandoned_sets(p_failed_node integer)

Function Properties

Language: PLPGSQL

Return Type: bigint

declare
v_row record;
v_seq_id bigint;
v_local_node int4;
begin

	select getLocalNodeId('_schemadoc') into
			   v_local_node;

	if found then
		   --abandon all subscriptions from this origin.
		for v_row in select sub_set,sub_receiver from
			sl_subscribe, sl_set
			where sub_set=set_id and set_origin=p_failed_node
			and sub_receiver=v_local_node
		loop
				raise notice 'Slony-I: failover_abandon_set() is abandoning subscription to set % on node % because it is too far ahead', v_row.sub_set,
				v_local_node;
				--If this node is a provider for the set
				--then the receiver needs to be unsubscribed.
				--
			select unsubscribeSet(v_row.sub_set,
												v_local_node,true)
				   into v_seq_id;
		end loop;
	end if;

	return v_seq_id;
end