mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 17:06:29 +00:00
Consolidate disconnection calls
This commit is contained in:
11
repmgrd.c
11
repmgrd.c
@@ -931,10 +931,11 @@ do_failover(void)
|
|||||||
terminate(ERR_FAILOVER_FAIL);
|
terminate(ERR_FAILOVER_FAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Query all the nodes to determine which ones are ready */
|
/* Query all available nodes to determine readiness and LSN */
|
||||||
for (i = 0; i < total_nodes; i++)
|
for (i = 0; i < total_nodes; i++)
|
||||||
{
|
{
|
||||||
log_debug("checking node %i...\n", nodes[i].node_id);
|
log_debug("checking node %i...\n", nodes[i].node_id);
|
||||||
|
|
||||||
/* if the node is not visible, skip it */
|
/* if the node is not visible, skip it */
|
||||||
if (!nodes[i].is_visible)
|
if (!nodes[i].is_visible)
|
||||||
continue;
|
continue;
|
||||||
@@ -972,19 +973,17 @@ do_failover(void)
|
|||||||
|
|
||||||
log_debug(_("LSN of node %i is: %s\n"), nodes[i].node_id, PQgetvalue(res, 0, 0));
|
log_debug(_("LSN of node %i is: %s\n"), nodes[i].node_id, PQgetvalue(res, 0, 0));
|
||||||
|
|
||||||
|
PQclear(res);
|
||||||
|
PQfinish(node_conn);
|
||||||
|
|
||||||
/* If position is 0/0, error */
|
/* If position is 0/0, error */
|
||||||
if(xlog_recptr == InvalidXLogRecPtr)
|
if(xlog_recptr == InvalidXLogRecPtr)
|
||||||
{
|
{
|
||||||
PQclear(res);
|
|
||||||
PQfinish(node_conn);
|
|
||||||
log_info(_("InvalidXLogRecPtr detected on standby node %i\n"), nodes[i].node_id);
|
log_info(_("InvalidXLogRecPtr detected on standby node %i\n"), nodes[i].node_id);
|
||||||
terminate(ERR_FAILOVER_FAIL);
|
terminate(ERR_FAILOVER_FAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
nodes[i].xlog_location = xlog_recptr;
|
nodes[i].xlog_location = xlog_recptr;
|
||||||
|
|
||||||
PQclear(res);
|
|
||||||
PQfinish(node_conn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* last we get info about this node, and update shared memory */
|
/* last we get info about this node, and update shared memory */
|
||||||
|
|||||||
Reference in New Issue
Block a user