Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a7bf3e6

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 e9e05c6 commit a7bf3e6

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
@@ -882,6 +882,7 @@ getTimelineHistory(TimeLineID tli, bool is_source, int *nentries)
882882
pg_free(histfile);
883883
}
884884

885+
/* In debugging mode, print what we read */
885886
if (debug)
886887
{
887888
int i;
@@ -891,10 +892,7 @@ getTimelineHistory(TimeLineID tli, bool is_source, int *nentries)
891892
else
892893
pg_log_debug("Target timeline history:");
893894

894-
/*
895-
* Print the target timeline history.
896-
*/
897-
for (i = 0; i < targetNentries; i++)
895+
for (i = 0; i < *nentries; i++)
898896
{
899897
TimeLineHistoryEntry *entry;
900898

0 commit comments

Comments
 (0)