optional fast checkpointing

commandline -X/--fast-checkpoint
This commit is contained in:
Christoph Monech-Tegeder
2015-04-08 23:07:03 +02:00
parent 79728ba6dd
commit 196585c78a
3 changed files with 12 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
2.0.3 2015-??-??
Add option "--initdb-no-pwprompt" (Ian)
Add -S/--superuser option for witness database creation Ian)
Add -X/--fast-checkpoint option for cloning (Christoph)
2.0.2 2015-02-17
Add "--checksum" in rsync when using "--force" (Jaime)

View File

@@ -110,6 +110,7 @@ main(int argc, char **argv)
{"wait", no_argument, NULL, 'W'},
{"ignore-rsync-warning", no_argument, NULL, 'I'},
{"verbose", no_argument, NULL, 'v'},
{"fast-checkpoint", no_argument, NULL, 'X'},
{NULL, 0, NULL, 0}
};
@@ -134,7 +135,7 @@ main(int argc, char **argv)
}
while ((c = getopt_long(argc, argv, "d:h:p:U:D:l:f:R:w:k:FWIv", long_options,
while ((c = getopt_long(argc, argv, "d:h:p:U:D:l:f:R:w:k:FWIvX", long_options,
&optindex)) != -1)
{
switch (c)
@@ -187,6 +188,9 @@ main(int argc, char **argv)
case 'v':
runtime_options.verbose = true;
break;
case 'X':
runtime_options.fast_checkpoint = true;
break;
default:
usage();
exit(ERR_BAD_CONFIG);
@@ -1106,8 +1110,9 @@ do_standby_clone(void)
*/
sqlquery_snprintf(
sqlquery,
"SELECT pg_xlogfile_name(pg_start_backup('repmgr_standby_clone_%ld'))",
time(NULL));
"SELECT pg_xlogfile_name(pg_start_backup('repmgr_standby_clone_%ld', '%c'))",
time(NULL),
runtime_options.fast_checkpoint ? 't' : 'f');
log_debug(_("standby clone: %s\n"), sqlquery);
res = PQexec(conn, sqlquery);
if (PQresultStatus(res) != PGRES_TUPLES_OK)
@@ -1944,6 +1949,7 @@ help(const char *progname)
printf(_(" -F, --force force potentially dangerous operations\n" \
" to happen\n"));
printf(_(" -W, --wait wait for a master to appear\n"));
printf(_(" -X, --fast-checkpoint force immediate checkpoint when cloning\n"));
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"));

View File

@@ -61,6 +61,7 @@ typedef struct
bool force;
bool wait_for_master;
bool ignore_rsync_warn;
bool fast_checkpoint;
char masterport[MAXLEN];
char localport[MAXLEN];
@@ -69,6 +70,6 @@ typedef struct
int keep_history;
} t_runtime_options;
#define T_RUNTIME_OPTIONS_INITIALIZER { "", "", "", "", "", "", DEFAULT_WAL_KEEP_SEGMENTS, false, false, false, false, "", "", 0 }
#define T_RUNTIME_OPTIONS_INITIALIZER { "", "", "", "", "", "", DEFAULT_WAL_KEEP_SEGMENTS, false, false, false, false, false, "", "", 0 }
#endif