Fix a few problems introduced in 020e17b059

while adding standby_name
This commit is contained in:
Jaime Casanova
2011-08-09 02:01:00 -05:00
parent 3d53661d97
commit 65cf045a63
2 changed files with 7 additions and 7 deletions

View File

@@ -318,7 +318,7 @@ getMasterConnection(PGconn *standby_conn, char *schema, int id, char *cluster,
log_info(_("finding node list for cluster '%s'\n"),
cluster);
sqlquery_snprintf(sqlquery, "SELECT * FROM %s.repl_nodes "
sqlquery_snprintf(sqlquery, "SELECT id, conninfo FROM %s.repl_nodes "
" WHERE cluster = '%s' and id <> %d and not witness",
schema_quoted, cluster, id);
@@ -336,7 +336,7 @@ getMasterConnection(PGconn *standby_conn, char *schema, int id, char *cluster,
{
/* initialize with the values of the current node being processed */
*master_id = atoi(PQgetvalue(res1, i, 0));
strncpy(master_conninfo, PQgetvalue(res1, i, 2), MAXCONNINFO);
strncpy(master_conninfo, PQgetvalue(res1, i, 1), MAXCONNINFO);
log_info(_("checking role of cluster node '%s'\n"),
master_conninfo);
master_conn = establishDBConnection(master_conninfo, false);

View File

@@ -519,7 +519,7 @@ do_master_register(void)
}
sqlquery_snprintf(sqlquery, "INSERT INTO %s.repl_nodes (id, cluster, name, conninfo, priority) "
"VALUES (%d, '%s', '%s', %d)",
"VALUES (%d, '%s', '%s', '%s', %d)",
repmgr_schema, options.node, options.cluster_name, options.node_name,
options.conninfo, options.priority);
log_debug(_("master register: %s\n"), sqlquery);
@@ -662,7 +662,7 @@ do_standby_register(void)
}
sqlquery_snprintf(sqlquery, "INSERT INTO %s.repl_nodes(id, cluster, name, conninfo, priority) "
"VALUES (%d, '%s', '%s', %d)",
"VALUES (%d, '%s', '%s', '%s', %d)",
repmgr_schema, options.node, options.cluster_name, options.node_name,
options.conninfo, options.priority);
log_debug(_("standby register: %s\n"), sqlquery);
@@ -1516,9 +1516,9 @@ do_witness_create(void)
}
/* register ourselves in the master */
sqlquery_snprintf(sqlquery, "INSERT INTO %s.repl_nodes(id, cluster, conninfo, priority, witness) "
"VALUES (%d, '%s', '%s', %d, true)",
repmgr_schema, options.node, options.cluster_name, options.conninfo);
sqlquery_snprintf(sqlquery, "INSERT INTO %s.repl_nodes(id, cluster, name, conninfo, priority, witness) "
"VALUES (%d, '%s', '%s', '%s', %d, true)",
repmgr_schema, options.node, options.cluster_name, options.node_name, options.conninfo);
log_debug(_("witness create: %s"), sqlquery);
if (!PQexec(masterconn, sqlquery))