@@ -795,7 +795,7 @@ static int readFile = -1;
795795static XLogSegNo readSegNo = 0 ;
796796static uint32 readOff = 0 ;
797797static uint32 readLen = 0 ;
798- static XLogSource readSource = 0 ; /* XLOG_FROM_* code */
798+ static XLogSource readSource = XLOG_FROM_ANY ;
799799
800800/*
801801 * Keeps track of which source we're currently reading from. This is
@@ -804,7 +804,7 @@ static XLogSource readSource = 0; /* XLOG_FROM_* code */
804804 * attempt to read from currentSource failed, and we should try another source
805805 * next.
806806 */
807- static XLogSource currentSource = 0 ; /* XLOG_FROM_* code */
807+ static XLogSource currentSource = XLOG_FROM_ANY ;
808808static bool lastSourceFailed = false;
809809
810810typedef struct XLogPageReadPrivate
@@ -823,7 +823,7 @@ typedef struct XLogPageReadPrivate
823823 * XLogReceiptSource tracks where we last successfully read some WAL.)
824824 */
825825static TimestampTz XLogReceiptTime = 0 ;
826- static XLogSource XLogReceiptSource = 0 ; /* XLOG_FROM_* code */
826+ static XLogSource XLogReceiptSource = XLOG_FROM_ANY ;
827827
828828/* State information for XLOG reading */
829829static XLogRecPtr ReadRecPtr ; /* start of last record read */
@@ -886,8 +886,8 @@ static bool InstallXLogFileSegment(XLogSegNo *segno, char *tmppath,
886886 bool find_free , XLogSegNo max_segno ,
887887 bool use_lock );
888888static int XLogFileRead (XLogSegNo segno , int emode , TimeLineID tli ,
889- int source , bool notfoundOk );
890- static int XLogFileReadAnyTLI (XLogSegNo segno , int emode , int source );
889+ XLogSource source , bool notfoundOk );
890+ static int XLogFileReadAnyTLI (XLogSegNo segno , int emode , XLogSource source );
891891static int XLogPageRead (XLogReaderState * xlogreader , XLogRecPtr targetPagePtr ,
892892 int reqLen , XLogRecPtr targetRecPtr , char * readBuf );
893893static bool WaitForWALToBecomeAvailable (XLogRecPtr RecPtr , bool randAccess ,
@@ -3633,7 +3633,7 @@ XLogFileOpen(XLogSegNo segno)
36333633 */
36343634static int
36353635XLogFileRead (XLogSegNo segno , int emode , TimeLineID tli ,
3636- int source , bool notfoundOk )
3636+ XLogSource source , bool notfoundOk )
36373637{
36383638 char xlogfname [MAXFNAMELEN ];
36393639 char activitymsg [MAXFNAMELEN + 16 ];
@@ -3715,7 +3715,7 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
37153715 * This version searches for the segment with any TLI listed in expectedTLEs.
37163716 */
37173717static int
3718- XLogFileReadAnyTLI (XLogSegNo segno , int emode , int source )
3718+ XLogFileReadAnyTLI (XLogSegNo segno , int emode , XLogSource source )
37193719{
37203720 char path [MAXPGPATH ];
37213721 ListCell * cell ;
@@ -4387,7 +4387,7 @@ ReadRecord(XLogReaderState *xlogreader, int emode,
43874387 * so that we will check the archive next.
43884388 */
43894389 lastSourceFailed = false;
4390- currentSource = 0 ;
4390+ currentSource = XLOG_FROM_ANY ;
43914391
43924392 continue ;
43934393 }
@@ -11673,7 +11673,7 @@ XLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr, int reqLen,
1167311673
1167411674 close (readFile );
1167511675 readFile = -1 ;
11676- readSource = 0 ;
11676+ readSource = XLOG_FROM_ANY ;
1167711677 }
1167811678
1167911679 XLByteToSeg (targetPagePtr , readSegNo , wal_segment_size );
@@ -11693,7 +11693,7 @@ XLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr, int reqLen,
1169311693 close (readFile );
1169411694 readFile = -1 ;
1169511695 readLen = 0 ;
11696- readSource = 0 ;
11696+ readSource = XLOG_FROM_ANY ;
1169711697
1169811698 return -1 ;
1169911699 }
@@ -11799,7 +11799,7 @@ XLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr, int reqLen,
1179911799 close (readFile );
1180011800 readFile = -1 ;
1180111801 readLen = 0 ;
11802- readSource = 0 ;
11802+ readSource = XLOG_FROM_ANY ;
1180311803
1180411804 /* In standby-mode, keep trying */
1180511805 if (StandbyMode )
@@ -11870,7 +11870,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
1187011870 */
1187111871 if (!InArchiveRecovery )
1187211872 currentSource = XLOG_FROM_PG_WAL ;
11873- else if (currentSource == 0 ||
11873+ else if (currentSource == XLOG_FROM_ANY ||
1187411874 (!StandbyMode && currentSource == XLOG_FROM_STREAM ))
1187511875 {
1187611876 lastSourceFailed = false;
@@ -11879,7 +11879,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
1187911879
1188011880 for (;;)
1188111881 {
11882- int oldSource = currentSource ;
11882+ XLogSource oldSource = currentSource ;
1188311883
1188411884 /*
1188511885 * First check if we failed to read from the current source, and
0 commit comments