diff options
author | Bruce Momjian <bruce@momjian.us> | 2012-11-30 17:51:53 -0500 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2012-12-03 22:45:02 -0500 |
commit | cd7569a5462cc083f59209ca5b0055ce883dbedd (patch) | |
tree | 48e230e5a95bccbc650c9ba26d6e959da22a9283 /src | |
parent | db00d837c17cebf3769fd3b6655812e2d3776f5d (diff) | |
download | postgresql-cd7569a5462cc083f59209ca5b0055ce883dbedd.tar.gz postgresql-cd7569a5462cc083f59209ca5b0055ce883dbedd.zip |
dummy commit
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/initdb/initdb.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index 402504b2578..8c0a9f41abf 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -118,6 +118,7 @@ static const char *authmethodlocal = ""; static bool debug = false; static bool noclean = false; static bool do_sync = true; +static bool sync_only = false; static bool show_setting = false; static char *xlog_dir = ""; @@ -2796,6 +2797,7 @@ usage(const char *progname) printf(_(" -n, --noclean do not clean up after errors\n")); printf(_(" -N, --nosync do not wait for changes to be written safely to disk\n")); printf(_(" -s, --show show internal settings\n")); + printf(_(" -S, --sync-only only sync data directory\n")); printf(_("\nOther options:\n")); printf(_(" -V, --version output version information, then exit\n")); printf(_(" -?, --help show this help, then exit\n")); @@ -3445,6 +3447,7 @@ main(int argc, char *argv[]) {"show", no_argument, NULL, 's'}, {"noclean", no_argument, NULL, 'n'}, {"nosync", no_argument, NULL, 'N'}, + {"sync-only", no_argument, NULL, 'S'}, {"xlogdir", required_argument, NULL, 'X'}, {NULL, 0, NULL, 0} }; @@ -3476,7 +3479,7 @@ main(int argc, char *argv[]) /* process command-line options */ - while ((c = getopt_long(argc, argv, "dD:E:L:nNU:WA:sT:X:", long_options, &option_index)) != -1) + while ((c = getopt_long(argc, argv, "dD:E:L:nNU:WA:sST:X:", long_options, &option_index)) != -1) { switch (c) { @@ -3522,6 +3525,9 @@ main(int argc, char *argv[]) case 'N': do_sync = false; break; + case 'S': + sync_only = true; + break; case 'L': share_path = pg_strdup(optarg); break; @@ -3589,6 +3595,14 @@ main(int argc, char *argv[]) exit(1); } + /* If we only need to fsync, just to it and exit */ + if (sync_only) + { + setup_pgdata(); + perform_fsync(); + return 0; + } + if (pwprompt && pwfilename) { fprintf(stderr, _("%s: password prompt and password file cannot be specified together\n"), progname); |