Commit 6f3823b0 authored by Michael Paquier's avatar Michael Paquier

Fix --dry-run mode of pg_rewind

Even if --dry-run mode was specified, the control file was getting
updated, preventing follow-up runs of pg_rewind to work properly on the
target data folder.  The origin of the problem came from the refactoring
done by ce6afc68.

Author: Alexey Kondratov
Discussion: https://postgr.es/m/7ca88204-3e0b-2f4c-c8af-acadc4b266e5@postgrespro.ru
Backpatch-through: 12
parent 8e10405c
...@@ -435,7 +435,8 @@ main(int argc, char **argv) ...@@ -435,7 +435,8 @@ main(int argc, char **argv)
ControlFile_new.minRecoveryPoint = endrec; ControlFile_new.minRecoveryPoint = endrec;
ControlFile_new.minRecoveryPointTLI = endtli; ControlFile_new.minRecoveryPointTLI = endtli;
ControlFile_new.state = DB_IN_ARCHIVE_RECOVERY; ControlFile_new.state = DB_IN_ARCHIVE_RECOVERY;
update_controlfile(datadir_target, &ControlFile_new, do_sync); if (!dry_run)
update_controlfile(datadir_target, &ControlFile_new, do_sync);
if (showprogress) if (showprogress)
pg_log_info("syncing target data directory"); pg_log_info("syncing target data directory");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment