From 5e48a19ebe8827229fb606b1efbf5c814ab2e549 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Fri, 5 May 2017 21:03:16 +0900 Subject: [PATCH] "standby clone": process -w/--wal-keep-segment --- repmgr-action-standby.c | 4 ++++ repmgr-client.c | 13 +++++++++++-- repmgr-client.h | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/repmgr-action-standby.c b/repmgr-action-standby.c index 290c2e99..bbfe399c 100644 --- a/repmgr-action-standby.c +++ b/repmgr-action-standby.c @@ -216,6 +216,10 @@ do_standby_clone(void) * the upstream is not available, so no point in checking for it. * * XXX not sure of the logic here (and yes I did think this up) + * - we'll need the source connection in any case, just won't connect + * to the "upstream_conninfo" server. We'd probably need to + * to override "no_upstream_connection" if connection params + * actually provided. */ if (*runtime_options.upstream_conninfo) diff --git a/repmgr-client.c b/repmgr-client.c index 20f96434..d3395e90 100644 --- a/repmgr-client.c +++ b/repmgr-client.c @@ -297,6 +297,15 @@ main(int argc, char **argv) runtime_options.rsync_only = true; break; + /* -w/--wal-keep-segments */ + case 'w': + repmgr_atoi(optarg, "-w/--wal-keep-segments", &cli_errors, false); + strncpy(runtime_options.wal_keep_segments, + optarg, + MAXLEN); + runtime_options.wal_keep_segments_used = true; + break; + /* --no-upstream-connection */ case OPT_NO_UPSTREAM_CONNECTION: runtime_options.no_upstream_connection = true; @@ -310,7 +319,7 @@ main(int argc, char **argv) if (targ < 1) { - item_list_append(&cli_errors, _("Invalid value provided for '--recovery-min-apply-delay'")); + item_list_append(&cli_errors, _("invalid value provided for '--recovery-min-apply-delay'")); break; } if (ptr && *ptr) @@ -320,7 +329,7 @@ main(int argc, char **argv) strcmp(ptr, "d") != 0) { item_list_append(&cli_errors, - _("Value provided for '--recovery-min-apply-delay' must be one of ms/s/min/h/d")); + _("value provided for '--recovery-min-apply-delay' must be one of ms/s/min/h/d")); break; } } diff --git a/repmgr-client.h b/repmgr-client.h index 4249a726..5021df77 100644 --- a/repmgr-client.h +++ b/repmgr-client.h @@ -96,6 +96,7 @@ static struct option long_options[] = {"copy-external-config-files", optional_argument, NULL, OPT_COPY_EXTERNAL_CONFIG_FILES}, {"fast-checkpoint", no_argument, NULL, 'c'}, {"rsync-only", no_argument, NULL, 'r'}, + {"wal-keep-segments", required_argument, NULL, 'w'}, {"no-upstream-connection", no_argument, NULL, OPT_NO_UPSTREAM_CONNECTION}, {"recovery-min-apply-delay", required_argument, NULL, OPT_RECOVERY_MIN_APPLY_DELAY}, {"replication-user", required_argument, NULL, OPT_REPLICATION_USER}, @@ -115,7 +116,6 @@ static struct option long_options[] = {"no-conninfo-password", no_argument, NULL, OPT_NO_CONNINFO_PASSWORD}, /* not yet handled */ - {"wal-keep-segments", required_argument, NULL, 'w'}, {"keep-history", required_argument, NULL, 'k'}, {"wait", no_argument, NULL, 'W'}, {"rsync-only", no_argument, NULL, 'r'},