@@ -36,6 +36,7 @@ static bool getRecordTimestamp(XLogReaderState *record, TimestampTz *recordXtime
3636static int xlogreadfd = -1 ;
3737static XLogSegNo xlogreadsegno = -1 ;
3838static char xlogfpath [MAXPGPATH ];
39+ static bool xlogexists = false;
3940
4041typedef struct XLogPageReadPrivate
4142{
@@ -98,6 +99,7 @@ extractPageMap(const char *archivedir, XLogRecPtr startpoint, TimeLineID tli,
9899 {
99100 close (xlogreadfd );
100101 xlogreadfd = -1 ;
102+ xlogexists = false;
101103 }
102104}
103105
@@ -192,9 +194,9 @@ validate_wal(pgBackup *backup,
192194 if (xlogfpath [0 ] != 0 )
193195 {
194196 /* XLOG reader couldnt read WAL segment */
195- if (xlogreadfd < 0 )
197+ if (! xlogexists )
196198 elog (WARNING , "WAL segment \"%s\" is absent" , xlogfpath );
197- else
199+ else if ( xlogreadfd != -1 )
198200 elog (WARNING , "error was occured during reading WAL segment \"%s\"" ,
199201 xlogfpath );
200202 }
@@ -232,6 +234,7 @@ validate_wal(pgBackup *backup,
232234 {
233235 close (xlogreadfd );
234236 xlogreadfd = -1 ;
237+ xlogexists = false;
235238 }
236239}
237240
@@ -256,6 +259,7 @@ SimpleXLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr,
256259 {
257260 close (xlogreadfd );
258261 xlogreadfd = -1 ;
262+ xlogexists = false;
259263 }
260264
261265 XLByteToSeg (targetPagePtr , xlogreadsegno );
@@ -272,11 +276,12 @@ SimpleXLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr,
272276 {
273277 elog (LOG , "opening WAL segment \"%s\"" , xlogfpath );
274278
279+ xlogexists = true;
275280 xlogreadfd = open (xlogfpath , O_RDONLY | PG_BINARY , 0 );
276281
277282 if (xlogreadfd < 0 )
278283 {
279- elog (INFO , "could not open WAL segment \"%s\": %s" ,
284+ elog (WARNING , "could not open WAL segment \"%s\": %s" ,
280285 xlogfpath , strerror (errno ));
281286 return -1 ;
282287 }
0 commit comments