From 7ccefe8610db8b339bad2c5b51abc07448a32947 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Thu, 7 Mar 2013 12:18:41 +0200 Subject: Fix tli history file fetching, broken by the archive after crash recevery patch. If we were about to enter archive recovery after crash recovery, we scanned the archive for the latest tli history file, and set the recovery target timeline to that. However, when we actually tried to read the history file, we would not fetch the file from the archive, because we were not in archive recovery yet. To fix, make readTimeLineHistory and existsTimeLineHistory to always fetch the file from archive if archive recovery is requested, even if we're not in archive recovery yet. Backpatch to 9.2. Mitsumasa KONDO --- src/backend/access/transam/timeline.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/backend/access/transam/timeline.c') diff --git a/src/backend/access/transam/timeline.c b/src/backend/access/transam/timeline.c index 51b37ca8f8c..921da62c22a 100644 --- a/src/backend/access/transam/timeline.c +++ b/src/backend/access/transam/timeline.c @@ -92,7 +92,7 @@ readTimeLineHistory(TimeLineID targetTLI) return list_make1(entry); } - if (InArchiveRecovery) + if (ArchiveRecoveryRequested) { TLHistoryFileName(histfname, targetTLI); fromArchive = @@ -213,7 +213,7 @@ existsTimeLineHistory(TimeLineID probeTLI) if (probeTLI == 1) return false; - if (InArchiveRecovery) + if (ArchiveRecoveryRequested) { TLHistoryFileName(histfname, probeTLI); RestoreArchivedFile(path, histfname, "RECOVERYHISTORY", 0, false); @@ -316,7 +316,7 @@ writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI, /* * If a history file exists for the parent, copy it verbatim */ - if (InArchiveRecovery) + if (ArchiveRecoveryRequested) { TLHistoryFileName(histfname, parentTLI); RestoreArchivedFile(path, histfname, "RECOVERYHISTORY", 0, false); -- cgit v1.2.3