From 8543c0bcf684b753f43305d66bc997418dce95f1 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Wed, 4 Nov 2020 12:00:42 +0900 Subject: [PATCH] standby clone: emit pg_basebackup command in --dry-run mode --- repmgr-action-standby.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/repmgr-action-standby.c b/repmgr-action-standby.c index 54615412..651264fd 100644 --- a/repmgr-action-standby.c +++ b/repmgr-action-standby.c @@ -670,6 +670,15 @@ do_standby_clone(void) log_hint(_("consider using the -c/--fast-checkpoint option")); } + if (mode == pg_basebackup) + { + /* + * In --dry-run mode, this will just output the pg_basebackup command which + * would be executed. + */ + run_basebackup(&local_node_record); + } + PQfinish(source_conn); log_info(_("all prerequisites for \"standby clone\" are met")); @@ -6776,6 +6785,13 @@ run_basebackup(t_node_info *node_record) termPQExpBuffer(¶ms); + if (runtime_options.dry_run == true) + { + log_info(_("would execute:\n %s"), script.data); + termPQExpBuffer(&script); + return SUCCESS; + } + log_info(_("executing:\n %s"), script.data); /*