Function is_witness() no longer required

Node type can be extracted directly from the metadata
This commit is contained in:
Ian Barwick
2015-01-27 15:32:13 +09:00
parent b552710767
commit 99dae5cdcb
2 changed files with 0 additions and 33 deletions

View File

@@ -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 */
bool
is_pgup(PGconn *conn, int timeout)

View File

@@ -30,7 +30,6 @@ PGconn *establish_db_connection_by_params(const char *keywords[],
const bool exit_on_error);
bool check_cluster_schema(PGconn *conn);
int is_standby(PGconn *conn);
int is_witness(PGconn *conn,char *cluster, int node_id);
bool is_pgup(PGconn *conn, int timeout);
int get_primary_node_id(PGconn *conn, char *cluster);
int get_server_version(PGconn *conn, char *server_version);