mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 00:46:29 +00:00
Fix CLUSTER SHOW, that i have broken
This commit is contained in:
14
repmgr.c
14
repmgr.c
@@ -353,6 +353,7 @@ static void
|
|||||||
do_cluster_show(void)
|
do_cluster_show(void)
|
||||||
{
|
{
|
||||||
PGconn *conn;
|
PGconn *conn;
|
||||||
|
PGconn *node_conn = NULL;
|
||||||
PGresult *res;
|
PGresult *res;
|
||||||
char sqlquery[QUERY_STR_LEN];
|
char sqlquery[QUERY_STR_LEN];
|
||||||
char node_role[MAXLEN];
|
char node_role[MAXLEN];
|
||||||
@@ -373,16 +374,14 @@ do_cluster_show(void)
|
|||||||
PQfinish(conn);
|
PQfinish(conn);
|
||||||
exit(ERR_BAD_CONFIG);
|
exit(ERR_BAD_CONFIG);
|
||||||
}
|
}
|
||||||
PQclear(res);
|
|
||||||
PQfinish(conn);
|
|
||||||
|
|
||||||
printf("Role | Connection String \n");
|
printf("Role | Connection String \n");
|
||||||
for (i = 0; i < PQntuples(res); i++)
|
for (i = 0; i < PQntuples(res); i++)
|
||||||
{
|
{
|
||||||
conn = establishDBConnection(PQgetvalue(res, i, 0), false);
|
node_conn = establishDBConnection(PQgetvalue(res, i, 0), false);
|
||||||
if (PQstatus(conn) != CONNECTION_OK)
|
if (PQstatus(node_conn) != CONNECTION_OK)
|
||||||
strcpy(node_role, " FAILED");
|
strcpy(node_role, " FAILED");
|
||||||
else if (is_standby(conn))
|
else if (is_standby(node_conn))
|
||||||
strcpy(node_role, " standby");
|
strcpy(node_role, " standby");
|
||||||
else
|
else
|
||||||
strcpy(node_role, "* master");
|
strcpy(node_role, "* master");
|
||||||
@@ -390,9 +389,10 @@ do_cluster_show(void)
|
|||||||
printf("%-10s", node_role);
|
printf("%-10s", node_role);
|
||||||
printf("| %s\n", PQgetvalue(res, i, 0));
|
printf("| %s\n", PQgetvalue(res, i, 0));
|
||||||
|
|
||||||
PQclear(res);
|
PQfinish(node_conn);
|
||||||
PQfinish(conn);
|
|
||||||
}
|
}
|
||||||
|
PQclear(res);
|
||||||
|
PQfinish(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user