"standby switchover": close all connections used to check repmgrd status

The connections used to check repmgrd status on all nodes were not being
closed if repmgrd was not running. Normally this wouldn't be a huge
problem as they will go away when repmgr terminates or the PostgreSQL
server restarted. However, if shutdown mode is "smart", the open
connection on the demotion candidate will cause the shutdown operation
to fail until repmgr times out.
This commit is contained in:
Ian Barwick
2018-10-23 10:51:57 +09:00
parent a4e21fd8fe
commit 79e79bd5f2

View File

@@ -3718,9 +3718,18 @@ do_standby_switchover(void)
i++;
}
}
else
{
/* close all connections - we'll reestablish later */
for (cell = all_nodes.head; cell; cell = cell->next)
{
PQfinish(cell->node_info->conn);
cell->node_info->conn = NULL;
}
}
}
/*
* Sanity checks completed - prepare for the switchover
*/
@@ -3801,7 +3810,7 @@ do_standby_switchover(void)
shutdown_command);
clear_node_info_list(&sibling_nodes);
clear_node_info_list(&all_nodes);
key_value_list_free(&remote_config_files);
return;
@@ -4160,8 +4169,6 @@ do_standby_switchover(void)
clear_node_info_list(&sibling_nodes);
PQfinish(local_conn);
/*