Skip to content

Commit c2e3b31

Browse files
committed
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 ce6afc6. Author: Alexey Kondratov Discussion: https://postgr.es/m/7ca88204-3e0b-2f4c-c8af-acadc4b266e5@postgrespro.ru Backpatch-through: 12
1 parent 8381242 commit c2e3b31

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/bin/pg_rewind/pg_rewind.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ main(int argc, char **argv)
388388
ControlFile_new.minRecoveryPoint = endrec;
389389
ControlFile_new.minRecoveryPointTLI = endtli;
390390
ControlFile_new.state = DB_IN_ARCHIVE_RECOVERY;
391-
update_controlfile(datadir_target, &ControlFile_new, do_sync);
391+
if (!dry_run)
392+
update_controlfile(datadir_target, &ControlFile_new, do_sync);
392393

393394
if (showprogress)
394395
pg_log_info("syncing target data directory");

0 commit comments

Comments
 (0)