From ae1fc93e489184f4c11d77f918dc033532f42be6 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Fri, 9 Feb 2018 11:06:15 +0900 Subject: [PATCH] Ensure correct server version number used for replication stats query --- repmgr-action-standby.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/repmgr-action-standby.c b/repmgr-action-standby.c index 7733128b..b2e6faae 100644 --- a/repmgr-action-standby.c +++ b/repmgr-action-standby.c @@ -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 ) {