1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2024-12-11 11:41:33 +02:00

PGPRO-427: Use xlogreader API to locate right start LSN

This commit is contained in:
Arthur Zakirov 2018-07-18 14:41:03 +03:00
parent 64262950c3
commit 6577c9b8e8

View File

@ -105,6 +105,7 @@ typedef struct XLogPageReadPrivate
/* An argument for a thread function */
typedef struct
{
int thread_num;
XLogPageReadPrivate private_data;
XLogRecPtr startpoint;
@ -148,6 +149,14 @@ doExtractPageMap(void *arg)
if (xlogreader == NULL)
elog(ERROR, "out of memory");
extract_arg->startpoint = XLogFindNextRecord(xlogreader,
extract_arg->startpoint);
elog(VERBOSE, "Start LSN of thread %d: %X/%X",
extract_arg->thread_num,
(uint32) (extract_arg->startpoint >> 32),
(uint32) (extract_arg->startpoint));
do
{
XLogRecord *record;
@ -180,7 +189,13 @@ doExtractPageMap(void *arg)
XLogSegNoOffsetToRecPtr(extract_arg->private_data.xlogsegno, 0,
extract_arg->startpoint);
/* Skip over the page header */
extract_arg->startpoint += SizeOfXLogLongPHD;
extract_arg->startpoint = XLogFindNextRecord(xlogreader,
extract_arg->startpoint);
elog(VERBOSE, "Thread %d switched to LSN %X/%X",
extract_arg->thread_num,
(uint32) (extract_arg->startpoint >> 32),
(uint32) (extract_arg->startpoint));
continue;
}
@ -266,6 +281,7 @@ extractPageMap(const char *archivedir, XLogRecPtr startpoint, TimeLineID tli,
for (i = 0; i < num_threads; i++)
{
InitXLogPageRead(&thread_args[i].private_data, archivedir, tli, false);
thread_args[i].thread_num = i;
thread_args[i].private_data.manual_switch = true;
thread_args[i].startpoint = startpoint;