mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 16:46:28 +00:00
Fix a segmentation fault that was happening in STANDBY PROMOTE and
STANDBY FOLLOW because getMasterConnection() was trying to close a non existent connection
This commit is contained in:
@@ -172,7 +172,7 @@ getMasterConnection(PGconn *standby_conn, int id, char *cluster, int *master_id)
|
|||||||
res2 = PQexec(master_conn, "SELECT pg_is_in_recovery()");
|
res2 = PQexec(master_conn, "SELECT pg_is_in_recovery()");
|
||||||
if (PQresultStatus(res2) != PGRES_TUPLES_OK)
|
if (PQresultStatus(res2) != PGRES_TUPLES_OK)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Can't get nodes info: %s\n", PQerrorMessage(master_conn));
|
fprintf(stderr, "Can't get recovery state from this node: %s\n", PQerrorMessage(master_conn));
|
||||||
PQclear(res2);
|
PQclear(res2);
|
||||||
PQfinish(master_conn);
|
PQfinish(master_conn);
|
||||||
continue;
|
continue;
|
||||||
@@ -202,9 +202,7 @@ getMasterConnection(PGconn *standby_conn, int id, char *cluster, int *master_id)
|
|||||||
* to start failover procedure or just fix some situation on the
|
* to start failover procedure or just fix some situation on the
|
||||||
* standby.
|
* standby.
|
||||||
*/
|
*/
|
||||||
fprintf(stderr, "There isn't a master node in the cluster\n");
|
|
||||||
PQclear(res1);
|
PQclear(res1);
|
||||||
PQfinish(master_conn);
|
return NULL;
|
||||||
return (PGconn *) NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user