From e36b180de8bb95cdcd6be14219b7cd26755166a5 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 6eaa07d0..b7068e38 100644 --- a/repmgr-action-standby.c +++ b/repmgr-action-standby.c @@ -2620,6 +2620,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] = ""; @@ -2685,6 +2686,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"), @@ -3150,7 +3153,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 @@ -3317,7 +3320,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 ) {