@@ -430,9 +430,9 @@ static intemode_for_corrupt_record(int emode, XLogRecPtr RecPtr);
430430static XLogRecord * ReadCheckpointRecord (XLogPrefetcher * xlogprefetcher ,
431431XLogRecPtr RecPtr ,TimeLineID replayTLI );
432432static bool rescanLatestTimeLine (TimeLineID replayTLI ,XLogRecPtr replayLSN );
433- static int XLogFileRead (XLogSegNo segno ,int emode , TimeLineID tli ,
433+ static int XLogFileRead (XLogSegNo segno ,TimeLineID tli ,
434434XLogSource source ,bool notfoundOk );
435- static int XLogFileReadAnyTLI (XLogSegNo segno ,int emode , XLogSource source );
435+ static int XLogFileReadAnyTLI (XLogSegNo segno ,XLogSource source );
436436
437437static bool CheckForStandbyTrigger (void );
438438static void SetPromoteIsTriggered (void );
@@ -3780,7 +3780,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
37803780 * Try to restore the file from archive, or read an existing
37813781 * file from pg_wal.
37823782 */
3783- readFile = XLogFileReadAnyTLI (readSegNo ,DEBUG2 ,
3783+ readFile = XLogFileReadAnyTLI (readSegNo ,
37843784currentSource == XLOG_FROM_ARCHIVE ?XLOG_FROM_ANY :
37853785currentSource );
37863786if (readFile >=0 )
@@ -3929,8 +3929,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
39293929{
39303930if (!expectedTLEs )
39313931expectedTLEs = readTimeLineHistory (recoveryTargetTLI );
3932- readFile = XLogFileRead (readSegNo ,PANIC ,
3933- receiveTLI ,
3932+ readFile = XLogFileRead (readSegNo ,receiveTLI ,
39343933XLOG_FROM_STREAM , false);
39353934Assert (readFile >=0 );
39363935}
@@ -4201,7 +4200,7 @@ rescanLatestTimeLine(TimeLineID replayTLI, XLogRecPtr replayLSN)
42014200 * Otherwise, it's assumed to be already available in pg_wal.
42024201 */
42034202static int
4204- XLogFileRead (XLogSegNo segno ,int emode , TimeLineID tli ,
4203+ XLogFileRead (XLogSegNo segno ,TimeLineID tli ,
42054204XLogSource source ,bool notfoundOk )
42064205{
42074206char xlogfname [MAXFNAMELEN ];
@@ -4283,7 +4282,7 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
42834282 * This version searches for the segment with any TLI listed in expectedTLEs.
42844283 */
42854284static int
4286- XLogFileReadAnyTLI (XLogSegNo segno ,int emode , XLogSource source )
4285+ XLogFileReadAnyTLI (XLogSegNo segno ,XLogSource source )
42874286{
42884287char path [MAXPGPATH ];
42894288ListCell * cell ;
@@ -4347,8 +4346,7 @@ XLogFileReadAnyTLI(XLogSegNo segno, int emode, XLogSource source)
43474346
43484347if (source == XLOG_FROM_ANY || source == XLOG_FROM_ARCHIVE )
43494348{
4350- fd = XLogFileRead (segno ,emode ,tli ,
4351- XLOG_FROM_ARCHIVE , true);
4349+ fd = XLogFileRead (segno ,tli ,XLOG_FROM_ARCHIVE , true);
43524350if (fd != -1 )
43534351{
43544352elog (DEBUG1 ,"got WAL segment from archive" );
@@ -4360,8 +4358,7 @@ XLogFileReadAnyTLI(XLogSegNo segno, int emode, XLogSource source)
43604358
43614359if (source == XLOG_FROM_ANY || source == XLOG_FROM_PG_WAL )
43624360{
4363- fd = XLogFileRead (segno ,emode ,tli ,
4364- XLOG_FROM_PG_WAL , true);
4361+ fd = XLogFileRead (segno ,tli ,XLOG_FROM_PG_WAL , true);
43654362if (fd != -1 )
43664363{
43674364if (!expectedTLEs )
@@ -4374,7 +4371,7 @@ XLogFileReadAnyTLI(XLogSegNo segno, int emode, XLogSource source)
43744371/* Couldn't find it. For simplicity, complain about front timeline */
43754372XLogFilePath (path ,recoveryTargetTLI ,segno ,wal_segment_size );
43764373errno = ENOENT ;
4377- ereport (emode ,
4374+ ereport (DEBUG2 ,
43784375(errcode_for_file_access (),
43794376errmsg ("could not open file \"%s\": %m" ,path )));
43804377return -1 ;