From 9aaf7d79a29f7bfe89599be779c9a387c0532620 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Wed, 30 Sep 2020 14:52:29 +0900 Subject: [PATCH] standby switchover: in Pg13 and later, promotion overrides paused WAL replay Preventing a switchover in this case no longer makes sense, so we apply the checks to PostgreSQL 12 and earlier only. --- repmgr-action-standby.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/repmgr-action-standby.c b/repmgr-action-standby.c index 619bb611..d0d01db3 100644 --- a/repmgr-action-standby.c +++ b/repmgr-action-standby.c @@ -2390,7 +2390,7 @@ do_standby_promote(void) if (PQserverVersion(local_conn) >= 100000) log_hint(_("execute \"pg_wal_replay_resume()\" to unpause WAL replay")); else - log_hint(_("execute \"pg_xlog_replay_resume()\" to unpause WAL replay")); + log_hint(_("execute \"pg_xlog_replay_resume()\" to npause WAL replay")); PQfinish(local_conn); exit(ERR_PROMOTION_FAIL); @@ -3813,8 +3813,9 @@ do_standby_switchover(void) } /* - * Check that WAL replay on the standby is *not* paused, as that could lead - * to unexpected behaviour when the standby is promoted. + * In PostgreSQL 12 and earlier, check that WAL replay on the standby + * is *not* paused, as that could lead to unexpected behaviour when the + * standby is promoted. * * For switchover we'll mandate that WAL replay *must not* be paused. * For a promote operation we can proceed if WAL replay is paused and @@ -3824,7 +3825,7 @@ do_standby_switchover(void) * the primary completely. */ - if (is_wal_replay_paused(local_conn, false) == true) + if (PQserverVersion(local_conn) < 130000 && is_wal_replay_paused(local_conn, false) == true) { ReplInfo replication_info; init_replication_info(&replication_info);