mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-25 16:16:29 +00:00
Function is_witness() no longer required
Node type can be extracted directly from the metadata
This commit is contained in:
32
dbutils.c
32
dbutils.c
@@ -138,38 +138,6 @@ is_standby(PGconn *conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
is_witness(PGconn *conn, char *cluster, int node_id)
|
|
||||||
{
|
|
||||||
PGresult *res;
|
|
||||||
int result = 0;
|
|
||||||
char sqlquery[QUERY_STR_LEN];
|
|
||||||
|
|
||||||
// ZZZ witness
|
|
||||||
sqlquery_snprintf(sqlquery,
|
|
||||||
"SELECT TRUE "
|
|
||||||
" FROM %s.repl_nodes "
|
|
||||||
" WHERE cluster = '%s' "
|
|
||||||
" AND id = %d "
|
|
||||||
" AND type = 'witness' ",
|
|
||||||
get_repmgr_schema_quoted(conn),
|
|
||||||
cluster,
|
|
||||||
node_id);
|
|
||||||
|
|
||||||
res = PQexec(conn, sqlquery);
|
|
||||||
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
|
||||||
{
|
|
||||||
log_err(_("Can't query server mode: %s"), PQerrorMessage(conn));
|
|
||||||
result = -1;
|
|
||||||
}
|
|
||||||
else if (PQntuples(res) == 1 && strcmp(PQgetvalue(res, 0, 0), "t") == 0)
|
|
||||||
result = 1;
|
|
||||||
|
|
||||||
PQclear(res);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* check the PQStatus and try to 'select 1' to confirm good connection */
|
/* check the PQStatus and try to 'select 1' to confirm good connection */
|
||||||
bool
|
bool
|
||||||
is_pgup(PGconn *conn, int timeout)
|
is_pgup(PGconn *conn, int timeout)
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ PGconn *establish_db_connection_by_params(const char *keywords[],
|
|||||||
const bool exit_on_error);
|
const bool exit_on_error);
|
||||||
bool check_cluster_schema(PGconn *conn);
|
bool check_cluster_schema(PGconn *conn);
|
||||||
int is_standby(PGconn *conn);
|
int is_standby(PGconn *conn);
|
||||||
int is_witness(PGconn *conn,char *cluster, int node_id);
|
|
||||||
bool is_pgup(PGconn *conn, int timeout);
|
bool is_pgup(PGconn *conn, int timeout);
|
||||||
int get_primary_node_id(PGconn *conn, char *cluster);
|
int get_primary_node_id(PGconn *conn, char *cluster);
|
||||||
int get_server_version(PGconn *conn, char *server_version);
|
int get_server_version(PGconn *conn, char *server_version);
|
||||||
|
|||||||
Reference in New Issue
Block a user