Fix issues in pg_rewind with --no-ensure-shutdown/--write-recovery-conf
This fixes two issues with recent features added in pg_rewind: - --dry-run should do nothing on the target directory, but 927474c forgot to consider that for --write-recovery-conf. - --no-ensure-shutdown was not actually working. There is no test coverage for this option yet, but a subsequent patch will add that. Author: Alexey Kondratov Discussion: https://postgr.es/m/7ca88204-3e0b-2f4c-c8af-acadc4b266e5@postgrespro.ru
This commit is contained in:
parent
6f3823b035
commit
6837632b75
@ -101,7 +101,7 @@ main(int argc, char **argv)
|
|||||||
{"write-recovery-conf", no_argument, NULL, 'R'},
|
{"write-recovery-conf", no_argument, NULL, 'R'},
|
||||||
{"source-pgdata", required_argument, NULL, 1},
|
{"source-pgdata", required_argument, NULL, 1},
|
||||||
{"source-server", required_argument, NULL, 2},
|
{"source-server", required_argument, NULL, 2},
|
||||||
{"no-ensure-shutdown", no_argument, NULL, 44},
|
{"no-ensure-shutdown", no_argument, NULL, 4},
|
||||||
{"version", no_argument, NULL, 'V'},
|
{"version", no_argument, NULL, 'V'},
|
||||||
{"dry-run", no_argument, NULL, 'n'},
|
{"dry-run", no_argument, NULL, 'n'},
|
||||||
{"no-sync", no_argument, NULL, 'N'},
|
{"no-sync", no_argument, NULL, 'N'},
|
||||||
@ -180,9 +180,11 @@ main(int argc, char **argv)
|
|||||||
case 1: /* --source-pgdata */
|
case 1: /* --source-pgdata */
|
||||||
datadir_source = pg_strdup(optarg);
|
datadir_source = pg_strdup(optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: /* --source-server */
|
case 2: /* --source-server */
|
||||||
connstr_source = pg_strdup(optarg);
|
connstr_source = pg_strdup(optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
no_ensure_shutdown = true;
|
no_ensure_shutdown = true;
|
||||||
break;
|
break;
|
||||||
@ -341,7 +343,7 @@ main(int argc, char **argv)
|
|||||||
if (!rewind_needed)
|
if (!rewind_needed)
|
||||||
{
|
{
|
||||||
pg_log_info("no rewind required");
|
pg_log_info("no rewind required");
|
||||||
if (writerecoveryconf)
|
if (writerecoveryconf && !dry_run)
|
||||||
WriteRecoveryConfig(conn, datadir_target,
|
WriteRecoveryConfig(conn, datadir_target,
|
||||||
GenerateRecoveryConfig(conn, NULL));
|
GenerateRecoveryConfig(conn, NULL));
|
||||||
exit(0);
|
exit(0);
|
||||||
@ -442,7 +444,7 @@ main(int argc, char **argv)
|
|||||||
pg_log_info("syncing target data directory");
|
pg_log_info("syncing target data directory");
|
||||||
syncTargetDirectory();
|
syncTargetDirectory();
|
||||||
|
|
||||||
if (writerecoveryconf)
|
if (writerecoveryconf && !dry_run)
|
||||||
WriteRecoveryConfig(conn, datadir_target,
|
WriteRecoveryConfig(conn, datadir_target,
|
||||||
GenerateRecoveryConfig(conn, NULL));
|
GenerateRecoveryConfig(conn, NULL));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user