Consolidate some code

This commit is contained in:
Ian Barwick
2019-04-25 16:04:40 +09:00
parent c8d52bab6d
commit 2082a8d3f3
3 changed files with 17 additions and 23 deletions

View File

@@ -1977,6 +1977,22 @@ format_node_status(t_node_info *node_info, PQExpBufferData *details, ItemList *w
{
bool error_found = false;
if (PQstatus(node_info->conn) == CONNECTION_OK)
{
node_info->node_status = NODE_STATUS_UP;
node_info->recovery_type = get_recovery_type(node_info->conn);
}
else
{
/* check if node is reachable, but just not letting us in */
if (is_server_available_quiet(node_info->conninfo))
node_info->node_status = NODE_STATUS_REJECTED;
else
node_info->node_status = NODE_STATUS_DOWN;
node_info->recovery_type = RECTYPE_UNKNOWN;
}
/*
* TODO: count nodes marked as "? unreachable" and add a hint about
* the other cluster commands for better determining whether