Slony-I 2.0.8 Documentation | ||||
---|---|---|---|---|
Prev | Fast Backward | Chapter 6. Schema schemadoc | Fast Forward | Next |
6.71. initializelocalnode(integer, text)
Function Properties
Language: PLPGSQL
Return Type: integer
no_id - Node ID # no_comment - Human-oriented comment Initializes the new node, no_iddeclare p_local_node_id alias for $1; p_comment alias for $2; v_old_node_id int4; v_first_log_no int4; v_event_seq int8; begin -- ---- -- Grab the central configuration lock -- ---- lock table sl_config_lock; -- ---- -- Make sure this node is uninitialized or got reset -- ---- select last_value::int4 into v_old_node_id from sl_local_node_id; if v_old_node_id != -1 then raise exception 'Slony-I: This node is already initialized'; end if; -- ---- -- Set sl_local_node_id to the requested value and add our -- own system to sl_node. -- ---- perform setval('sl_local_node_id', p_local_node_id); perform storeNode_int (p_local_node_id, p_comment); if (pg_catalog.current_setting('max_identifier_length')::integer - pg_catalog.length('schemadoc')) < 5 then raise notice 'Slony-I: Cluster name length [%] versus system max_identifier_length [%] ', pg_catalog.length('schemadoc'), pg_catalog.current_setting('max_identifier_length'); raise notice 'leaves narrow/no room for some Slony-I-generated objects (such as indexes).'; raise notice 'You may run into problems later!'; end if; return p_local_node_id; end;