System Administration Functions
This reference describes administration functions for operators. These functions require elevated privileges and can affect cluster availability.
Coordinator management
gp_remove_coordinator_by_dbid
Removes a coordinator entry from the gp_segment_configuration catalog by its dbid.
Signature
gp_remove_coordinator_by_dbid(dbid int2) RETURNS boolean
When to use it
This function gives operators a safe, explicit way to remove a coordinator entry from gp_segment_configuration. Use it when you need to delete a specific coordinator entry by its dbid.
You cannot use this function to remove the running coordinator: it rejects the dbid of the coordinator that you are connected to.
Prerequisites
You connect to the coordinator node in utility mode.
You connect as a superuser.
You know the
dbidof the entry to remove. Querygp_segment_configurationfirst to confirm.
Procedure
Connect to the coordinator node in utility mode as a superuser:
PGOPTIONS='-c gp_session_role=utility' psql -U gpadmin -d postgres
Confirm the target entry:
SELECT dbid, content, role, status, hostname FROM gp_segment_configuration WHERE dbid = <target-dbid>;
Remove the entry:
SELECT gp_remove_coordinator_by_dbid(<target-dbid>::int2);
The parameter type is
int2. You must cast integer literals explicitly; otherwise the type resolver reportsfunction does not exist. The function returnstrueon success.
Safety notes
The function rejects the
dbidof the running coordinator.The function rejects any
dbidthat does not identify a coordinator entry. Other rows ingp_segment_configurationare not modified.The function holds
AccessExclusiveLockongp_segment_configurationuntil it returns. All other reads and writes on that catalog wait for the call to complete.