1.57. enablenode( integer )

Function Properties

Language: PLPGSQL

Return Type: bigint

no_id - Node ID # Generate the ENABLE_NODE event for node no_id

declare
	p_no_id			alias for $1;
	v_local_node_id	int4;
	v_node_row		record;
begin
	-- ----
	-- Grab the central configuration lock
	-- ----
	lock table sl_config_lock;

	-- ----
	-- Check that we are the node to activate and that we are
	-- currently disabled.
	-- ----
	v_local_node_id := getLocalNodeId('_schemadoc');
	select * into v_node_row
			from sl_node
			where no_id = p_no_id
			for update;
	if not found then 
		raise exception 'Slony-I: node % not found', p_no_id;
	end if;
	if v_node_row.no_active then
		raise exception 'Slony-I: node % is already active', p_no_id;
	end if;

	-- ----
	-- Activate this node and generate the ENABLE_NODE event
	-- ----
	perform enableNode_int (p_no_id);
	return  createEvent('_schemadoc', 'ENABLE_NODE',
									p_no_id);
end;