Remove ssh_hostname support

Currently repmgr assumes the SSH hostname will be the same as the
database hostname, and it's easy enough now to extract this
from the node's conninfo string.

We can consider re-adding this in the next release if required.
This commit is contained in:
Ian Barwick
2016-09-29 00:24:04 +09:00
parent 9b5b9acb82
commit 41ec45a4cc
8 changed files with 23 additions and 54 deletions

View File

@@ -1227,7 +1227,7 @@ witness_copy_node_records(PGconn *masterconn, PGconn *witnessconn, char *cluster
/* Get current records from primary */
sqlquery_snprintf(sqlquery,
"SELECT id, type, upstream_node_id, name, conninfo, ssh_command, priority, slot_name, active FROM %s.repl_nodes",
"SELECT id, type, upstream_node_id, name, conninfo, priority, slot_name, active FROM %s.repl_nodes",
get_repmgr_schema_quoted(masterconn));
log_verbose(LOG_DEBUG, "witness_copy_node_records():\n%s\n", sqlquery);
@@ -1263,7 +1263,6 @@ witness_copy_node_records(PGconn *masterconn, PGconn *witnessconn, char *cluster
cluster_name,
PQgetvalue(res, i, 3),
PQgetvalue(res, i, 4),
PQgetvalue(res, i, 5),
atoi(PQgetvalue(res, i, 6)),
strlen(PQgetvalue(res, i, 7))
? PQgetvalue(res, i, 7)
@@ -1301,7 +1300,7 @@ witness_copy_node_records(PGconn *masterconn, PGconn *witnessconn, char *cluster
* XXX we should pass the record parameters as a struct.
*/
bool
create_node_record(PGconn *conn, char *action, int node, char *type, int upstream_node, char *cluster_name, char *node_name, char *conninfo, char *ssh_hostname, int priority, char *slot_name, bool active)
create_node_record(PGconn *conn, char *action, int node, char *type, int upstream_node, char *cluster_name, char *node_name, char *conninfo, int priority, char *slot_name, bool active)
{
char sqlquery[QUERY_STR_LEN];
char upstream_node_id[MAXLEN];
@@ -1342,9 +1341,9 @@ create_node_record(PGconn *conn, char *action, int node, char *type, int upstrea
sqlquery_snprintf(sqlquery,
"INSERT INTO %s.repl_nodes "
" (id, type, upstream_node_id, cluster, "
" name, conninfo, ssh_hostname, slot_name, "
" name, conninfo, slot_name, "
" priority, active) "
"VALUES (%i, '%s', %s, '%s', '%s', '%s', '%s', %s, %i, %s) ",
"VALUES (%i, '%s', %s, '%s', '%s', '%s', %s, %i, %s) ",
get_repmgr_schema_quoted(conn),
node,
type,
@@ -1352,7 +1351,6 @@ create_node_record(PGconn *conn, char *action, int node, char *type, int upstrea
cluster_name,
node_name,
conninfo,
ssh_hostname,
slot_name_buf,
priority,
active == true ? "TRUE" : "FALSE");
@@ -1719,7 +1717,7 @@ get_node_record(PGconn *conn, char *cluster, int node_id, t_node_info *node_info
sqlquery_snprintf(
sqlquery,
"SELECT id, type, upstream_node_id, name, conninfo, ssh_hostname, "
"SELECT id, type, upstream_node_id, name, conninfo, "
" slot_name, priority, active"
" FROM %s.repl_nodes "
" WHERE cluster = '%s' "
@@ -1793,10 +1791,9 @@ _get_node_record(PGconn *conn, char *cluster, char *sqlquery, t_node_info *node_
node_info->upstream_node_id = atoi(PQgetvalue(res, 0, 2));
strncpy(node_info->name, PQgetvalue(res, 0, 3), MAXLEN);
strncpy(node_info->conninfo_str, PQgetvalue(res, 0, 4), MAXLEN);
strncpy(node_info->ssh_hostname_str, PQgetvalue(res, 0, 5), MAXLEN);
strncpy(node_info->slot_name, PQgetvalue(res, 0, 6), MAXLEN);
node_info->priority = atoi(PQgetvalue(res, 0, 7));
node_info->active = (strcmp(PQgetvalue(res, 0, 8), "t") == 0)
strncpy(node_info->slot_name, PQgetvalue(res, 0, 5), MAXLEN);
node_info->priority = atoi(PQgetvalue(res, 0, 6));
node_info->active = (strcmp(PQgetvalue(res, 0, 7), "t") == 0)
? true
: false;