diff --git a/HISTORY b/HISTORY
index abdaad9b..75073995 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,6 +1,7 @@
5.2.1 2020-??-??
config: fix parsing of "replication_type"
standby clone: handle missing "postgresql.auto.conf"
+ standby clone: add option --recovery-min-apply-delay
5.2.0 2020-10-22
general: add support for PostgreSQL 13 (Ian)
diff --git a/doc/repmgr-standby-clone.xml b/doc/repmgr-standby-clone.xml
index 95f4d5a2..3d40e5b3 100644
--- a/doc/repmgr-standby-clone.xml
+++ b/doc/repmgr-standby-clone.xml
@@ -331,6 +331,25 @@ pg_basebackup_options='--waldir=/path/to/wal-directory'
+
+
+
+
+
+ Set PostgreSQL configuration parameter
+ to the provided value.
+
+
+ This overrides any provided via
+ repmgr.conf.
+
+
+ For more details on this parameter, see:
+ recovery_min_apply_delay.
+
+
+
+
diff --git a/repmgr-client-global.h b/repmgr-client-global.h
index 57623a60..4dabcf1b 100644
--- a/repmgr-client-global.h
+++ b/repmgr-client-global.h
@@ -84,7 +84,7 @@ typedef struct
bool fast_checkpoint;
bool rsync_only;
bool no_upstream_connection;
- char recovery_min_apply_delay[MAXLEN];
+ char recovery_min_apply_delay[MAXLEN]; /* overrides setting in repmgr.conf */
char replication_user[MAXLEN];
char upstream_conninfo[MAXLEN];
bool without_barman;
diff --git a/repmgr-client.c b/repmgr-client.c
index 982a9131..b361cacb 100644
--- a/repmgr-client.c
+++ b/repmgr-client.c
@@ -438,6 +438,11 @@ main(int argc, char **argv)
runtime_options.replication_conf_only = true;
break;
+ /* --recovery-min-apply-delay */
+ case OPT_RECOVERY_MIN_APPLY_DELAY:
+ strncpy(runtime_options.recovery_min_apply_delay, optarg, sizeof(runtime_options.recovery_min_apply_delay));
+ break;
+
/* --verify-backup */
case OPT_VERIFY_BACKUP:
runtime_options.verify_backup = true;
@@ -1105,10 +1110,25 @@ main(int argc, char **argv)
exit(SUCCESS);
}
-
-
check_cli_parameters(action);
+
+ /*
+ * Command-line parameter --recovery-min-apply-delay overrides the equivalent
+ * setting in the config file. Note we'll need to parse it here to handle
+ * any formatting errors.
+ */
+
+ if (*runtime_options.recovery_min_apply_delay != '\0')
+ {
+ parse_time_unit_parameter("--recovery-min-apply-delay",
+ runtime_options.recovery_min_apply_delay,
+ config_file_options.recovery_min_apply_delay,
+ &cli_errors);
+
+ config_file_options.recovery_min_apply_delay_provided = true;
+ }
+
/*
* Sanity checks for command line parameters completed by now; any further
* errors will be runtime ones
diff --git a/repmgr-client.h b/repmgr-client.h
index 7d1df57a..f12de09a 100644
--- a/repmgr-client.h
+++ b/repmgr-client.h
@@ -99,6 +99,7 @@
#define OPT_REPLICATION_CONFIG_OWNER 1046
#define OPT_DB_CONNECTION 1047
#define OPT_VERIFY_BACKUP 1048
+#define OPT_RECOVERY_MIN_APPLY_DELAY 1049
/* These options are for internal use only */
#define OPT_CONFIG_ARCHIVE_DIR 2001
@@ -164,6 +165,7 @@ static struct option long_options[] =
{"without-barman", no_argument, NULL, OPT_WITHOUT_BARMAN},
{"replication-conf-only", no_argument, NULL, OPT_REPLICATION_CONF_ONLY},
{"verify-backup", no_argument, NULL, OPT_VERIFY_BACKUP },
+ {"recovery-min-apply-delay", required_argument, NULL, OPT_RECOVERY_MIN_APPLY_DELAY },
/* deprecate this once Pg11 and earlier are unsupported */
{"recovery-conf-only", no_argument, NULL, OPT_REPLICATION_CONF_ONLY},