Skip to content

Commit bb5592c

Browse files
committed
Fix pg_rewind debug output to print the source timeline history
getTimelineHistory() is called twice, to read the source and the target timeline history files. However, the loop to print the file with the --debug option used the wrong variable when dealing with the source. As a result, the source's history was always printed as empty. Spotted while debugging bug #18575, but this does not fix that bug, just the debugging output. Backpatch to all supported versions. Discussion: https://www.postgresql.org/message-id/092dd515-b7b4-4fd0-8407-ceca2f02f6ec@iki.fi
1 parent 3557185 commit bb5592c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/bin/pg_rewind/pg_rewind.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,7 @@ getTimelineHistory(ControlFileData *controlFile, int *nentries)
838838
pg_free(histfile);
839839
}
840840

841+
/* In debugging mode, print what we read */
841842
if (debug)
842843
{
843844
int i;
@@ -849,10 +850,7 @@ getTimelineHistory(ControlFileData *controlFile, int *nentries)
849850
else
850851
Assert(false);
851852

852-
/*
853-
* Print the target timeline history.
854-
*/
855-
for (i = 0; i < targetNentries; i++)
853+
for (i = 0; i < *nentries; i++)
856854
{
857855
TimeLineHistoryEntry *entry;
858856

0 commit comments

Comments
 (0)