mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 00:46:29 +00:00
Add "witness" as a node role in CLUSTER SHOW
This commit is contained in:
4
repmgr.c
4
repmgr.c
@@ -370,7 +370,7 @@ do_cluster_show(void)
|
|||||||
log_info(_("%s connecting to database\n"), progname);
|
log_info(_("%s connecting to database\n"), progname);
|
||||||
conn = establishDBConnection(options.conninfo, true);
|
conn = establishDBConnection(options.conninfo, true);
|
||||||
|
|
||||||
sqlquery_snprintf(sqlquery, "SELECT conninfo FROM %s.repl_nodes;", repmgr_schema);
|
sqlquery_snprintf(sqlquery, "SELECT conninfo, witness FROM %s.repl_nodes;", repmgr_schema);
|
||||||
res = PQexec(conn, sqlquery);
|
res = PQexec(conn, sqlquery);
|
||||||
|
|
||||||
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
||||||
@@ -388,6 +388,8 @@ do_cluster_show(void)
|
|||||||
conn = establishDBConnection(PQgetvalue(res, i, 0), false);
|
conn = establishDBConnection(PQgetvalue(res, i, 0), false);
|
||||||
if (PQstatus(conn) != CONNECTION_OK)
|
if (PQstatus(conn) != CONNECTION_OK)
|
||||||
strcpy(node_role, " FAILED");
|
strcpy(node_role, " FAILED");
|
||||||
|
else if (strcmp(PQgetvalue(res, i, 1), "t") == 0)
|
||||||
|
strcpy(node_role, " witness");
|
||||||
else if (is_standby(conn))
|
else if (is_standby(conn))
|
||||||
strcpy(node_role, " standby");
|
strcpy(node_role, " standby");
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user