From 55efbe60ea0bf306b5885ce989ab3494cebbd252 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Tue, 27 Jul 2021 17:01:27 +0900 Subject: [PATCH] standby switchover: optionally delay promotion This is for testing purposes only and should not be used in production. --- repmgr-action-standby.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/repmgr-action-standby.c b/repmgr-action-standby.c index 2c3268aa..4b094085 100644 --- a/repmgr-action-standby.c +++ b/repmgr-action-standby.c @@ -5230,6 +5230,18 @@ do_standby_switchover(void) format_lsn(replication_info.last_wal_receive_lsn), format_lsn(remote_last_checkpoint_lsn)); + /* + * optionally add a delay before promoting the standby; this is mainly + * useful for testing (e.g. for reappearance of the original primary) and + * is not documented. + */ + if (config_file_options.promote_delay > 0) + { + log_debug("sleeping %i seconds before promoting standby", + config_file_options.promote_delay); + sleep(config_file_options.promote_delay); + } + /* * Promote standby (local node). *