1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2024-12-04 10:44:46 +02:00

PGPRO-427: Check for absent WAL segments

This commit is contained in:
Arthur Zakirov 2018-08-14 17:47:56 +03:00
parent 4293603ed1
commit 4041a43db9

View File

@ -144,6 +144,7 @@ doExtractPageMap(void *arg)
XLogPageReadPrivate *private_data; XLogPageReadPrivate *private_data;
XLogReaderState *xlogreader; XLogReaderState *xlogreader;
XLogSegNo nextSegNo = 0; XLogSegNo nextSegNo = 0;
XLogRecPtr found;
char *errormsg; char *errormsg;
private_data = &extract_arg->private_data; private_data = &extract_arg->private_data;
@ -151,8 +152,20 @@ doExtractPageMap(void *arg)
if (xlogreader == NULL) if (xlogreader == NULL)
elog(ERROR, "out of memory"); elog(ERROR, "out of memory");
extract_arg->startpoint = XLogFindNextRecord(xlogreader, found = XLogFindNextRecord(xlogreader, extract_arg->startpoint);
extract_arg->startpoint);
/*
* We get invalid WAL record pointer usually when WAL segment is absent or
* is corrupted.
*/
if (XLogRecPtrIsInvalid(found))
{
elog(WARNING, "could not read WAL record at %X/%X",
(uint32) (extract_arg->startpoint >> 32),
(uint32) (extract_arg->startpoint));
PrintXLogCorruptionMsg(private_data, ERROR);
}
extract_arg->startpoint = found;
elog(VERBOSE, "Start LSN of thread %d: %X/%X", elog(VERBOSE, "Start LSN of thread %d: %X/%X",
extract_arg->thread_num, extract_arg->thread_num,
@ -199,8 +212,19 @@ doExtractPageMap(void *arg)
XLogSegNoOffsetToRecPtr(private_data->xlogsegno, 0, XLogSegNoOffsetToRecPtr(private_data->xlogsegno, 0,
extract_arg->startpoint); extract_arg->startpoint);
/* Skip over the page header */ /* Skip over the page header */
extract_arg->startpoint = XLogFindNextRecord(xlogreader, found = XLogFindNextRecord(xlogreader, extract_arg->startpoint);
extract_arg->startpoint); /*
* We get invalid WAL record pointer usually when WAL segment is
* absent or is corrupted.
*/
if (XLogRecPtrIsInvalid(found))
{
elog(WARNING, "could not read WAL record at %X/%X",
(uint32) (extract_arg->startpoint >> 32),
(uint32) (extract_arg->startpoint));
PrintXLogCorruptionMsg(private_data, ERROR);
}
extract_arg->startpoint = found;
elog(VERBOSE, "Thread %d switched to LSN %X/%X", elog(VERBOSE, "Thread %d switched to LSN %X/%X",
extract_arg->thread_num, extract_arg->thread_num,