1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-27 22:56:53 +03:00

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
This commit is contained in:
Heikki Linnakangas 2024-08-08 10:20:25 +03:00
parent ee2997c678
commit e8240dbd86

View File

@ -873,6 +873,7 @@ getTimelineHistory(TimeLineID tli, bool is_source, int *nentries)
pg_free(histfile); pg_free(histfile);
} }
/* In debugging mode, print what we read */
if (debug) if (debug)
{ {
int i; int i;
@ -882,10 +883,7 @@ getTimelineHistory(TimeLineID tli, bool is_source, int *nentries)
else else
pg_log_debug("Target timeline history:"); pg_log_debug("Target timeline history:");
/* for (i = 0; i < *nentries; i++)
* Print the target timeline history.
*/
for (i = 0; i < targetNentries; i++)
{ {
TimeLineHistoryEntry *entry; TimeLineHistoryEntry *entry;