Ensure correct server version number used for replication stats query

This commit is contained in:
Ian Barwick
2018-02-09 11:06:15 +09:00
parent 7b4ee80af2
commit ae1fc93e48

View File

@@ -2174,6 +2174,7 @@ do_standby_switchover(void)
PGconn *remote_conn = NULL;
t_node_info local_node_record = T_NODE_INFO_INITIALIZER;
int server_version_num = UNKNOWN_SERVER_VERSION_NUM;
/* the remote server is the primary to be demoted */
char remote_conninfo[MAXCONNINFO] = "";
@@ -2239,6 +2240,8 @@ do_standby_switchover(void)
exit(ERR_BAD_CONFIG);
}
server_version_num = get_server_version(local_conn, NULL);
if (runtime_options.dry_run == true)
{
log_notice(_("checking switchover on node \"%s\" (ID: %i) in --dry-run mode"),
@@ -2704,7 +2707,7 @@ do_standby_switchover(void)
* populate local node record with current state of various replication-related
* values, so we can check for sufficient walsenders and replication slots
*/
get_node_replication_stats(local_conn, source_server_version_num, &local_node_record);
get_node_replication_stats(local_conn, server_version_num, &local_node_record);
/*
* If --siblings-follow specified, get list and check they're reachable
@@ -2871,7 +2874,7 @@ do_standby_switchover(void)
/*
* if replication slots are required by demotion candidate and/or siblings,
* check the promotion candidate has sufficient free slots
x */
*/
if (min_required_free_slots > 0 )
{