Slony-I 2.0.8 Documentation | ||||
---|---|---|---|---|
Prev | Fast Backward | Chapter 6. Schema schemadoc | Fast Forward | Next |
6.121. storepath_int(integer, integer, text, integer)
Function Properties
Language: PLPGSQL
Return Type: integer
FUNCTION storePath (pa_server, pa_client, pa_conninfo, pa_connretry) Process the STORE_PATH event indicating that node pa_client can access node pa_server using DSN pa_conninfodeclare p_pa_server alias for $1; p_pa_client alias for $2; p_pa_conninfo alias for $3; p_pa_connretry alias for $4; v_dummy int4; begin -- ---- -- Grab the central configuration lock -- ---- lock table sl_config_lock; -- ---- -- Check if the path already exists -- ---- select 1 into v_dummy from sl_path where pa_server = p_pa_server and pa_client = p_pa_client for update; if found then -- ---- -- Path exists, update pa_conninfo -- ---- update sl_path set pa_conninfo = p_pa_conninfo, pa_connretry = p_pa_connretry where pa_server = p_pa_server and pa_client = p_pa_client; else -- ---- -- New path -- -- In case we receive STORE_PATH events before we know -- about the nodes involved in this, we generate those nodes -- as pending. -- ---- if not exists (select 1 from sl_node where no_id = p_pa_server) then perform storeNode_int (p_pa_server, '<event pending>'); end if; if not exists (select 1 from sl_node where no_id = p_pa_client) then perform storeNode_int (p_pa_client, '<event pending>'); end if; insert into sl_path (pa_server, pa_client, pa_conninfo, pa_connretry) values (p_pa_server, p_pa_client, p_pa_conninfo, p_pa_connretry); end if; -- Rewrite sl_listen table perform RebuildListenEntries(); return 0; end;