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

8.125. terminatenodeconnections(integer)

Function Properties

PLPGSQLinteger
terminates all backends that have registered to be from the given node
    declare
    	p_failed_node	alias for $1;
    	v_row			record;
    begin
    	for v_row in select nl_nodeid, nl_conncnt,
    			nl_backendpid from sl_nodelock
    			where nl_nodeid = p_failed_node for update
    	loop
    		perform killBackend(v_row.nl_backendpid, 'TERM');
    		delete from sl_nodelock
    			where nl_nodeid = v_row.nl_nodeid
    			and nl_conncnt = v_row.nl_conncnt;
    	end loop;
    
    	return 0;
    end;

Google

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

Contact me at cbbrowne@acm.org