Add checks for use of --upstream-node-id

This commit is contained in:
Ian Barwick
2017-06-26 10:22:27 +09:00
parent 60edb00bb4
commit 9bf264177f

View File

@@ -281,6 +281,14 @@ main(int argc, char **argv)
strncpy(runtime_options.node_name, optarg, MAXLEN);
break;
/* standby options *
* --------------- */
/* --upstream-node-id */
case OPT_UPSTREAM_NODE_ID:
runtime_options.upstream_node_id = repmgr_atoi(optarg, "--upstream-node-id", &cli_errors, false);
break;
/* standby clone options *
* --------------------- */
@@ -311,7 +319,7 @@ main(int argc, char **argv)
/* -w/--wal-keep-segments */
case 'w':
repmgr_atoi(optarg, "-w/--wal-keep-segments", &cli_errors, false);
(void) repmgr_atoi(optarg, "-w/--wal-keep-segments", &cli_errors, false);
strncpy(runtime_options.wal_keep_segments,
optarg,
MAXLEN);
@@ -354,10 +362,6 @@ main(int argc, char **argv)
strncpy(runtime_options.upstream_conninfo, optarg, MAXLEN);
break;
case OPT_UPSTREAM_NODE_ID:
//strncpy(runtime_options.upstream_conninfo, optarg, MAXLEN);
break;
case OPT_USE_RECOVERY_CONNINFO_PASSWORD:
runtime_options.use_recovery_conninfo_password = true;
break;
@@ -1075,6 +1079,20 @@ check_cli_parameters(const int action)
}
}
if (runtime_options.upstream_node_id != UNKNOWN_NODE_ID)
{
switch (action)
{
case STANDBY_CLONE:
case STANDBY_REGISTER:
break;
default:
item_list_append_format(&cli_warnings,
_("--upstream-node-id will be ignored when executing %s"),
action_name(action));
}
}
if (runtime_options.event[0])
{
switch (action)