diff --git a/src/backend/access/transam/timeline.c b/src/backend/access/transam/timeline.c index 8d0903c175..9483fd055c 100644 --- a/src/backend/access/transam/timeline.c +++ b/src/backend/access/transam/timeline.c @@ -55,6 +55,7 @@ restoreTimeLineHistoryFiles(TimeLineID begin, TimeLineID end) for (tli = begin; tli < end; tli++) { + elog(LOG, "Trying restoring history file for TLI=%d", tli); if (tli == 1) continue; @@ -95,6 +96,7 @@ readTimeLineHistory(TimeLineID targetTLI) if (ArchiveRecoveryRequested) { + elog(LOG, "Trying reading history file for TLI=%d", targetTLI); TLHistoryFileName(histfname, targetTLI); fromArchive = RestoreArchivedFile(path, histfname, "RECOVERYHISTORY", 0, false); @@ -231,6 +233,7 @@ existsTimeLineHistory(TimeLineID probeTLI) if (ArchiveRecoveryRequested) { + elog(LOG, "Probing history file for TLI=%d", probeTLI); TLHistoryFileName(histfname, probeTLI); RestoreArchivedFile(path, histfname, "RECOVERYHISTORY", 0, false); } diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index adfc6f67e2..e31e1f0ce3 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -3732,6 +3732,7 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli, snprintf(activitymsg, sizeof(activitymsg), "waiting for %s", xlogfname); set_ps_display(activitymsg); + elog(LOG, "Trying fetching history file for TLI=%d", tli); restoredFromArchive = RestoreArchivedFile(path, xlogfname, "RECOVERYXLOG", wal_segment_size, @@ -3825,7 +3826,10 @@ XLogFileReadAnyTLI(XLogSegNo segno, int emode, XLogSource source) if (expectedTLEs) tles = expectedTLEs; else + { + elog(LOG, "Loading history file for TLI=%d (2)", recoveryTargetTLI); tles = readTimeLineHistory(recoveryTargetTLI); + } foreach(cell, tles) { @@ -3839,6 +3843,8 @@ XLogFileReadAnyTLI(XLogSegNo segno, int emode, XLogSource source) * Skip scanning the timeline ID that the logfile segment to read * doesn't belong to */ + elog(LOG, "scanning segment %lX TLI %d, source %d", segno, tli, source); + if (hent->begin != InvalidXLogRecPtr) { XLogSegNo beginseg = 0; @@ -3865,6 +3871,7 @@ XLogFileReadAnyTLI(XLogSegNo segno, int emode, XLogSource source) XLOG_FROM_ARCHIVE, true); if (fd != -1) { + elog(LOG, "found segment %lX TLI %d, from archive", segno, tli); elog(DEBUG1, "got WAL segment from archive"); if (!expectedTLEs) expectedTLEs = tles; @@ -3878,6 +3885,7 @@ XLogFileReadAnyTLI(XLogSegNo segno, int emode, XLogSource source) XLOG_FROM_PG_WAL, true); if (fd != -1) { + elog(LOG, "found segment %lX TLI %d, from PG_WAL", segno, tli); if (!expectedTLEs) expectedTLEs = tles; return fd; @@ -8421,7 +8429,7 @@ ReadCheckpointRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr, XLogBeginRead(xlogreader, RecPtr); record = ReadRecord(xlogreader, LOG, true); - + elog(LOG, "Checkpoint record: TLI=%d, %X/%X, rectargetTLI=%d, exptles=%p", xlogreader->seg.ws_tli, LSN_FORMAT_ARGS(xlogreader->ReadRecPtr), recoveryTargetTLI, expectedTLEs); if (record == NULL) { if (!report) @@ -12628,7 +12636,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess, * TLI, rather than the position we're reading. */ tli = tliOfPointInHistory(tliRecPtr, expectedTLEs); - + elog(LOG, "%X/%X is on TLI %X", LSN_FORMAT_ARGS(tliRecPtr), tli); if (curFileTLI > 0 && tli < curFileTLI) elog(ERROR, "according to history file, WAL location %X/%X belongs to timeline %u, but previous recovered WAL file came from timeline %u", LSN_FORMAT_ARGS(tliRecPtr), @@ -12697,7 +12705,10 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess, if (readFile < 0) { if (!expectedTLEs) + { + elog(LOG, "Loading expectedTLEs for %d", receiveTLI); expectedTLEs = readTimeLineHistory(receiveTLI); + } readFile = XLogFileRead(readSegNo, PANIC, receiveTLI, XLOG_FROM_STREAM, false);