Change '-X/--fast-checkpoint' option to '-c/--fast-checkpoint'

Make consistent with same option added in 3.0. '-c' is similar to
pg_basebackup's '-c, --checkpoint=fast|spread' option; we may also
want to use -X for something more pg_xlog-related in future.

Also add missing 'break' statement
This commit is contained in:
Ian Barwick
2015-04-16 08:24:29 +09:00
parent e8bc5521a5
commit 341831ad69

View File

@@ -111,7 +111,7 @@ main(int argc, char **argv)
{"wait", no_argument, NULL, 'W'}, {"wait", no_argument, NULL, 'W'},
{"ignore-rsync-warning", no_argument, NULL, 'I'}, {"ignore-rsync-warning", no_argument, NULL, 'I'},
{"verbose", no_argument, NULL, 'v'}, {"verbose", no_argument, NULL, 'v'},
{"fast-checkpoint", no_argument, NULL, 'X'}, {"fast-checkpoint", no_argument, NULL, 'c'},
{"initdb-no-pwprompt", no_argument, NULL, 1}, {"initdb-no-pwprompt", no_argument, NULL, 1},
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };
@@ -137,7 +137,7 @@ main(int argc, char **argv)
} }
while ((c = getopt_long(argc, argv, "d:h:p:U:S:D:l:f:R:w:k:FWIvX", long_options, while ((c = getopt_long(argc, argv, "d:h:p:U:S:D:l:f:R:w:k:FWIvc", long_options,
&optindex)) != -1) &optindex)) != -1)
{ {
switch (c) switch (c)
@@ -193,8 +193,9 @@ main(int argc, char **argv)
case 'v': case 'v':
runtime_options.verbose = true; runtime_options.verbose = true;
break; break;
case 'X': case 'c':
runtime_options.fast_checkpoint = true; runtime_options.fast_checkpoint = true;
break;
case 1: case 1:
runtime_options.initdb_no_pwprompt = true; runtime_options.initdb_no_pwprompt = true;
break; break;
@@ -1117,9 +1118,9 @@ do_standby_clone(void)
*/ */
sqlquery_snprintf( sqlquery_snprintf(
sqlquery, sqlquery,
"SELECT pg_xlogfile_name(pg_start_backup('repmgr_standby_clone_%ld', '%c'))", "SELECT pg_xlogfile_name(pg_start_backup('repmgr_standby_clone_%ld', %s))",
time(NULL), time(NULL),
runtime_options.fast_checkpoint ? 't' : 'f'); runtime_options.fast_checkpoint ? "TRUE" : "FALSE");
log_debug(_("standby clone: %s\n"), sqlquery); log_debug(_("standby clone: %s\n"), sqlquery);
res = PQexec(conn, sqlquery); res = PQexec(conn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK) if (PQresultStatus(res) != PGRES_TUPLES_OK)
@@ -1963,7 +1964,7 @@ help(const char *progname)
printf(_(" -F, --force force potentially dangerous operations\n" \ printf(_(" -F, --force force potentially dangerous operations\n" \
" to happen\n")); " to happen\n"));
printf(_(" -W, --wait wait for a master to appear\n")); printf(_(" -W, --wait wait for a master to appear\n"));
printf(_(" -X, --fast-checkpoint force immediate checkpoint when cloning\n")); printf(_(" -c, --fast-checkpoint force fast checkpoint when cloning a standby\n"));
printf(_(" --initdb-no-pwprompt don't require superuser password when running initdb\n")); printf(_(" --initdb-no-pwprompt don't require superuser password when running initdb\n"));
printf(_("\n%s performs some tasks like clone a node, promote it or making follow\n"), progname); printf(_("\n%s performs some tasks like clone a node, promote it or making follow\n"), progname);
printf(_("another node and then exits.\n\n")); printf(_("another node and then exits.\n\n"));