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

# 8.70. failednode2(p_ev_seqfake integer, p_ev_seqno integer, p_set_id integer, p_backup_node bigint, p_failed_node bigint)

Function Properties

Language: PLPGSQL

Return Type: bigint

FUNCTION failedNode2 (failed_node, backup_node, set_id, ev_seqno, ev_seqfake) On the node that has the highest sequence number of the failed node, fake the FAILOVER_SET event.

    declare
    	v_row				record;
    begin
    	select * into v_row
    			from sl_event
    			where ev_origin = p_failed_node
    			and ev_seqno = p_ev_seqno;
    	if not found then
    		raise exception 'Slony-I: event %,% not found',
    				p_failed_node, p_ev_seqno;
    	end if;

    	insert into sl_event
    			(ev_origin, ev_seqno, ev_timestamp,
    			ev_snapshot,
    			ev_type, ev_data1, ev_data2, ev_data3)
    			values
    			(p_failed_node, p_ev_seqfake, CURRENT_TIMESTAMP,
    			v_row.ev_snapshot,
    			'FAILOVER_SET', p_failed_node::text, p_backup_node::text,
    			p_set_id::text);
    	insert into sl_confirm
    			(con_origin, con_received, con_seqno, con_timestamp)
    			values
    			(p_failed_node, getLocalNodeId('_schemadoc'),
    			p_ev_seqfake, CURRENT_TIMESTAMP);
    	notify "_schemadoc_Restart";

    	perform failoverSet_int(p_failed_node,
    			p_backup_node, p_set_id, p_ev_seqfake);

    	return p_ev_seqfake;
    end;

Prev | Home | Next
failednode(p_backup_node integer, p_failed_node integer) | Up | failoverset_int(p_wait_seqno integer, p_set_id integer, p_backup_node integer, p_failed_node bigint)