static XLogSegNo readSegNo = 0;
static uint32 readOff = 0;
static uint32 readLen = 0;
-static XLogSource readSource = 0; /* XLOG_FROM_* code */
+static XLogSource readSource = XLOG_FROM_ANY;
/*
* Keeps track of which source we're currently reading from. This is
* attempt to read from currentSource failed, and we should try another source
* next.
*/
-static XLogSource currentSource = 0; /* XLOG_FROM_* code */
+static XLogSource currentSource = XLOG_FROM_ANY;
static bool lastSourceFailed = false;
typedef struct XLogPageReadPrivate
* XLogReceiptSource tracks where we last successfully read some WAL.)
*/
static TimestampTz XLogReceiptTime = 0;
-static XLogSource XLogReceiptSource = 0; /* XLOG_FROM_* code */
+static XLogSource XLogReceiptSource = XLOG_FROM_ANY;
/* State information for XLOG reading */
static XLogRecPtr ReadRecPtr; /* start of last record read */
bool find_free, XLogSegNo max_segno,
bool use_lock);
static int XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
- int source, bool notfoundOk);
-static int XLogFileReadAnyTLI(XLogSegNo segno, int emode, int source);
+ XLogSource source, bool notfoundOk);
+static int XLogFileReadAnyTLI(XLogSegNo segno, int emode, XLogSource source);
static int XLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr,
int reqLen, XLogRecPtr targetRecPtr, char *readBuf);
static bool WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
*/
static int
XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
- int source, bool notfoundOk)
+ XLogSource source, bool notfoundOk)
{
char xlogfname[MAXFNAMELEN];
char activitymsg[MAXFNAMELEN + 16];
* This version searches for the segment with any TLI listed in expectedTLEs.
*/
static int
-XLogFileReadAnyTLI(XLogSegNo segno, int emode, int source)
+XLogFileReadAnyTLI(XLogSegNo segno, int emode, XLogSource source)
{
char path[MAXPGPATH];
ListCell *cell;
* so that we will check the archive next.
*/
lastSourceFailed = false;
- currentSource = 0;
+ currentSource = XLOG_FROM_ANY;
continue;
}
close(readFile);
readFile = -1;
- readSource = 0;
+ readSource = XLOG_FROM_ANY;
}
XLByteToSeg(targetPagePtr, readSegNo, wal_segment_size);
close(readFile);
readFile = -1;
readLen = 0;
- readSource = 0;
+ readSource = XLOG_FROM_ANY;
return -1;
}
close(readFile);
readFile = -1;
readLen = 0;
- readSource = 0;
+ readSource = XLOG_FROM_ANY;
/* In standby-mode, keep trying */
if (StandbyMode)
*/
if (!InArchiveRecovery)
currentSource = XLOG_FROM_PG_WAL;
- else if (currentSource == 0 ||
+ else if (currentSource == XLOG_FROM_ANY ||
(!StandbyMode && currentSource == XLOG_FROM_STREAM))
{
lastSourceFailed = false;
for (;;)
{
- int oldSource = currentSource;
+ XLogSource oldSource = currentSource;
/*
* First check if we failed to read from the current source, and