standby switchover: optionally delay promotion

This is for testing purposes only and should not be used in production.
This commit is contained in:
Ian Barwick
2021-07-27 17:01:27 +09:00
parent 132f5ebc08
commit 55efbe60ea

View File

@@ -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).
*