Slony-I 2.2.10 Documentation
Prev | Fast Backward | Chapter 8. Schema schemadoc | Fast Forward | Next

# 8.36. clonenodefinish(p_no_provider integer, p_no_id integer)

Function Properties

Language: PLPGSQL

Return Type: integer

Internal part of cloneNodePrepare().

    declare
    	v_row			record;
    begin
    	-- ----
    	-- Grab the central configuration lock
    	-- ----
    	lock table sl_config_lock;

    	perform "pg_catalog".setval('sl_local_node_id', p_no_id);
    	perform resetSession();
    	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(p_no_comment integer, p_no_provider integer, p_no_id text)