repmgr: enable "primary unregister --force" to unregister an active primary

The primary must have no registered standby nodes.

Also document usage when unregistering a primary node which is actually
running as a standby.
This commit is contained in:
Ian Barwick
2020-09-23 15:05:49 +09:00
parent cb86180f4f
commit 26b5664741
4 changed files with 24 additions and 2 deletions

View File

@@ -454,9 +454,9 @@ do_primary_unregister(void)
/*
* This appears to be the cluster primary - cowardly refuse to
* delete the record
* delete the record, unless --force is supplied.
*/
if (primary_node_info.node_id == target_node_info_ptr->node_id)
if (primary_node_info.node_id == target_node_info_ptr->node_id && !runtime_options.force)
{
log_error(_("node \"%s\" (ID: %i) is the current primary node, unable to unregister"),
target_node_info_ptr->node_name,