call update_node_record_set_upstream() for STANDBY FOLLOW

repmgrd correctly updates ID of the upstream node after automatic
failover, but repmgr was not doing that for manual failvers.

This moves the existing function to dbutils and modifies it so that
it does not rely on global variables with configuration (available
just in repmgrd).

This should fix issue #67 (hopefully, haven't done much testing).
This commit is contained in:
Tomas Vondra
2015-08-09 00:16:39 +02:00
committed by Ian Barwick
parent 42847e44d2
commit ef6b24551a
4 changed files with 45 additions and 40 deletions

View File

@@ -1689,6 +1689,7 @@ do_standby_follow(void)
char script[MAXLEN];
char master_conninfo[MAXLEN];
PGconn *master_conn;
int master_id;
int r,
retval;
@@ -1727,7 +1728,7 @@ do_standby_follow(void)
}
master_conn = get_master_connection(conn,
options.cluster_name, NULL, (char *) &master_conninfo);
options.cluster_name, &master_id, (char *) &master_conninfo);
}
while (master_conn == NULL && runtime_options.wait_for_master);
@@ -1796,6 +1797,13 @@ do_standby_follow(void)
exit(ERR_NO_RESTART);
}
if(update_node_record_set_upstream(master_conn, options.cluster_name,
options.node, master_id) == false)
{
log_err(_("unable to update upstream node"));
exit(ERR_BAD_CONFIG);
}
return;
}