forwardconfirm(p_con_timestamp integer, p_con_seqno integer, p_con_received bigint, p_con_origin timestamp without time zone)

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

# 8.68. forwardconfirm(p_con_timestamp integer, p_con_seqno integer, p_con_received bigint, p_con_origin timestamp without time zone)

Function Properties

Language: PLPGSQL

Return Type: bigint

forwardConfirm (p_con_origin, p_con_received, p_con_seqno, p_con_timestamp) Confirms (recorded in sl_confirm) that items from p_con_origin up to p_con_seqno have been received by node p_con_received as of p_con_timestamp, and raises an event to forward this confirmation.

    declare
    	v_max_seqno		bigint;
    begin
    	select into v_max_seqno coalesce(max(con_seqno), 0)
    			from sl_confirm
    			where con_origin = p_con_origin
    			and con_received = p_con_received;
    	if v_max_seqno < p_con_seqno then
    		insert into sl_confirm
    				(con_origin, con_received, con_seqno, con_timestamp)
    				values (p_con_origin, p_con_received, p_con_seqno,
    					p_con_timestamp);
    		v_max_seqno = p_con_seqno;
    	end if;

    	return v_max_seqno;
    end;

Prev | Home | Next
finishtableaftercopy(p_tab_id integer) | Up | generate_sync_event(p_interval interval)