clonenodefinish(integer, integer)

Slony-I 2.0.4 Documentation
Prev | Fast Backward | Chapter 1. Schema schemadoc | Fast Forward | Next

# 1.29. clonenodefinish(integer, integer)

Function Properties

Language: PLPGSQL

Return Type: integer

Internal part of cloneNodePrepare().

    declare
    	p_no_id			alias for $1;
    	p_no_provider	alias for $2;
    	v_row			record;
    begin
    	perform "pg_catalog".setval('sl_local_node_id', p_no_id);

    	for v_row in select sub_set from sl_subscribe
    			where sub_receiver = p_no_id
    	loop
    		perform updateReloid(v_row.sub_set, p_no_id);
    	end loop;

    	perform RebuildListenEntries();

    	delete from sl_confirm
    		where con_received = p_no_id;
    	insert into sl_confirm
    		(con_origin, con_received, con_seqno, con_timestamp)
    		select con_origin, p_no_id, con_seqno, con_timestamp
    		from sl_confirm
    		where con_received = p_no_provider;
    	insert into sl_confirm
    		(con_origin, con_received, con_seqno, con_timestamp)
    		select p_no_provider, p_no_id,
    				(select max(ev_seqno) from sl_event
    					where ev_origin = p_no_provider), current_timestamp;

    	return 0;
    end;

Prev | Home | Next
cleanupnodelock() | Up | clonenodeprepare(integer, integer, text)