diff --git a/HISTORY b/HISTORY index 99c34102..b640346e 100644 --- a/HISTORY +++ b/HISTORY @@ -3,6 +3,8 @@ server and logging output is not explicitly redirected (Ian) repmgr: improve switchover log messages and exit code when old primary could not be shut down cleanly (Ian) + repmgr: check demotion candidate can make a replication connection to the + promotion candidate before executing a switchover; GitHub #370 (Ian) repmgr: add check for sufficient walsenders/replication slots before executing a switchover; GitHub #371 (Ian) repmgr: add --dry-run mode to "repmgr standby follow"; GitHub #368 (Ian) diff --git a/dbutils.c b/dbutils.c index 5cf3fbc0..5a70c2a7 100644 --- a/dbutils.c +++ b/dbutils.c @@ -2647,6 +2647,11 @@ get_node_replication_stats(PGconn *conn, int server_version_num, t_node_info *no PQExpBufferData query; PGresult *res = NULL; + if (server_version_num == UNKNOWN_SERVER_VERSION_NUM) + server_version_num = get_server_version(conn, NULL); + + Assert(server_version_num != UNKNOWN_SERVER_VERSION_NUM); + initPQExpBuffer(&query); appendPQExpBuffer(&query, diff --git a/doc/appendix-release-notes.sgml b/doc/appendix-release-notes.sgml index 424e762d..ae153e26 100644 --- a/doc/appendix-release-notes.sgml +++ b/doc/appendix-release-notes.sgml @@ -47,6 +47,13 @@ + + + add check to verify the demotion candidate can make a replication connection to the + promotion candidate before executing a switchover (GitHub #370) + + + add check for sufficient walsenders and replication slots on the promotion candidate before executing diff --git a/repmgr-action-standby.c b/repmgr-action-standby.c index b2e6faae..2cb9f6f8 100644 --- a/repmgr-action-standby.c +++ b/repmgr-action-standby.c @@ -2174,7 +2174,6 @@ 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] = ""; @@ -2240,8 +2239,6 @@ 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"),