Christopher B. Browne's Home Page
cbbrowne@acm.org

8.27. cleanupnodelock()

Function Properties

PLPGSQLinteger
Clean up stale entries when restarting slon
    declare
    	v_row		record;
    begin
    	for v_row in select nl_nodeid, nl_conncnt, nl_backendpid
    			from sl_nodelock
    			for update
    	loop
    		if killBackend(v_row.nl_backendpid, 'NULL') < 0 then
    			raise notice 'Slony-I: cleanup stale sl_nodelock entry for pid=%',
    					v_row.nl_backendpid;
    			delete from sl_nodelock where
    					nl_nodeid = v_row.nl_nodeid and
    					nl_conncnt = v_row.nl_conncnt;
    		end if;
    	end loop;
    
    	return 0;
    end;

Google

If this was useful, let others know by an Affero rating

Contact me at cbbrowne@acm.org