Hi, Since 1bb2558046c, XLogFileRead() doesn't use the emode argument. Also, since abf5c5c9a4f, XLogFileReadAnyTLI() is called just once and emode is always DEBUG2. So, I think we can remove the emode argument from these functions. I've atached the patch.
Regards, Yugo Nagata -- Yugo Nagata <nag...@sraoss.co.jp>
diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c index 178491f6f5..b126533273 100644 --- a/src/backend/access/transam/xlogrecovery.c +++ b/src/backend/access/transam/xlogrecovery.c @@ -432,7 +432,7 @@ static XLogRecord *ReadCheckpointRecord(XLogPrefetcher *xlogprefetcher, static bool rescanLatestTimeLine(TimeLineID replayTLI, XLogRecPtr replayLSN); static int XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli, XLogSource source, bool notfoundOk); -static int XLogFileReadAnyTLI(XLogSegNo segno, int emode, XLogSource source); +static int XLogFileReadAnyTLI(XLogSegNo segno, XLogSource source); static bool CheckForStandbyTrigger(void); static void SetPromoteIsTriggered(void); @@ -3780,7 +3780,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess, * Try to restore the file from archive, or read an existing * file from pg_wal. */ - readFile = XLogFileReadAnyTLI(readSegNo, DEBUG2, + readFile = XLogFileReadAnyTLI(readSegNo, currentSource == XLOG_FROM_ARCHIVE ? XLOG_FROM_ANY : currentSource); if (readFile >= 0) @@ -4283,7 +4283,7 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli, * This version searches for the segment with any TLI listed in expectedTLEs. */ static int -XLogFileReadAnyTLI(XLogSegNo segno, int emode, XLogSource source) +XLogFileReadAnyTLI(XLogSegNo segno, XLogSource source) { char path[MAXPGPATH]; ListCell *cell; @@ -4347,7 +4347,7 @@ XLogFileReadAnyTLI(XLogSegNo segno, int emode, XLogSource source) if (source == XLOG_FROM_ANY || source == XLOG_FROM_ARCHIVE) { - fd = XLogFileRead(segno, emode, tli, + fd = XLogFileRead(segno, DEBUG2, tli, XLOG_FROM_ARCHIVE, true); if (fd != -1) { @@ -4360,7 +4360,7 @@ XLogFileReadAnyTLI(XLogSegNo segno, int emode, XLogSource source) if (source == XLOG_FROM_ANY || source == XLOG_FROM_PG_WAL) { - fd = XLogFileRead(segno, emode, tli, + fd = XLogFileRead(segno, DEBUG2, tli, XLOG_FROM_PG_WAL, true); if (fd != -1) { @@ -4374,7 +4374,7 @@ XLogFileReadAnyTLI(XLogSegNo segno, int emode, XLogSource source) /* Couldn't find it. For simplicity, complain about front timeline */ XLogFilePath(path, recoveryTargetTLI, segno, wal_segment_size); errno = ENOENT; - ereport(emode, + ereport(DEBUG2, (errcode_for_file_access(), errmsg("could not open file \"%s\": %m", path))); return -1;