You've already forked pg_probackup
mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2026-06-21 01:34:15 +02:00
[Issue #261] fix WAL parsing
This commit is contained in:
+6
-7
@@ -422,14 +422,13 @@ do_backup_instance(PGconn *backup_conn, PGNodeInfo *nodeInfo, bool no_sync, bool
|
||||
/* Extract information about files in backup_list parsing their names:*/
|
||||
parse_filelist_filenames(backup_files_list, instance_config.pgdata);
|
||||
|
||||
elog(LOG, "Current Start LSN: %X/%X, TLI: %X",
|
||||
(uint32) (current.start_lsn >> 32), (uint32) (current.start_lsn),
|
||||
current.tli);
|
||||
if (current.backup_mode != BACKUP_MODE_FULL)
|
||||
{
|
||||
elog(LOG, "Current tli: %X", current.tli);
|
||||
elog(LOG, "Parent start_lsn: %X/%X",
|
||||
(uint32) (prev_backup->start_lsn >> 32), (uint32) (prev_backup->start_lsn));
|
||||
elog(LOG, "start_lsn: %X/%X",
|
||||
(uint32) (current.start_lsn >> 32), (uint32) (current.start_lsn));
|
||||
}
|
||||
elog(LOG, "Parent Start LSN: %X/%X, TLI: %X",
|
||||
(uint32) (prev_backup->start_lsn >> 32), (uint32) (prev_backup->start_lsn),
|
||||
prev_backup->tli);
|
||||
|
||||
/*
|
||||
* Build page mapping in incremental mode.
|
||||
|
||||
+37
-3
@@ -553,6 +553,12 @@ read_recovery_info(const char *archivedir, TimeLineID tli, uint32 wal_seg_size,
|
||||
TimestampTz last_time = 0;
|
||||
char *errormsg;
|
||||
|
||||
#if PG_VERSION_NUM >= 130000
|
||||
if (XLogRecPtrIsInvalid(startpoint))
|
||||
startpoint = SizeOfXLogShortPHD;
|
||||
XLogBeginRead(xlogreader, startpoint);
|
||||
#endif
|
||||
|
||||
record = WalReadRecord(xlogreader, startpoint, &errormsg);
|
||||
if (record == NULL)
|
||||
{
|
||||
@@ -617,6 +623,12 @@ wal_contains_lsn(const char *archivedir, XLogRecPtr target_lsn,
|
||||
|
||||
xlogreader->system_identifier = instance_config.system_identifier;
|
||||
|
||||
#if PG_VERSION_NUM >= 130000
|
||||
if (XLogRecPtrIsInvalid(target_lsn))
|
||||
target_lsn = SizeOfXLogShortPHD;
|
||||
XLogBeginRead(xlogreader, target_lsn);
|
||||
#endif
|
||||
|
||||
res = WalReadRecord(xlogreader, target_lsn, &errormsg) != NULL;
|
||||
/* Didn't find 'target_lsn' and there is no error, return false */
|
||||
|
||||
@@ -658,6 +670,12 @@ get_first_record_lsn(const char *archivedir, XLogSegNo segno,
|
||||
/* Set startpoint to 0 in segno */
|
||||
GetXLogRecPtr(segno, 0, wal_seg_size, startpoint);
|
||||
|
||||
#if PG_VERSION_NUM >= 130000
|
||||
if (XLogRecPtrIsInvalid(startpoint))
|
||||
startpoint = SizeOfXLogShortPHD;
|
||||
XLogBeginRead(xlogreader, startpoint);
|
||||
#endif
|
||||
|
||||
while (attempts <= timeout)
|
||||
{
|
||||
record = XLogFindNextRecord(xlogreader, startpoint);
|
||||
@@ -712,6 +730,12 @@ get_next_record_lsn(const char *archivedir, XLogSegNo segno,
|
||||
/* Set startpoint to 0 in segno */
|
||||
GetXLogRecPtr(segno, 0, wal_seg_size, startpoint);
|
||||
|
||||
#if PG_VERSION_NUM >= 130000
|
||||
if (XLogRecPtrIsInvalid(startpoint))
|
||||
startpoint = SizeOfXLogShortPHD;
|
||||
XLogBeginRead(xlogreader, startpoint);
|
||||
#endif
|
||||
|
||||
found = XLogFindNextRecord(xlogreader, startpoint);
|
||||
|
||||
if (XLogRecPtrIsInvalid(found))
|
||||
@@ -824,6 +848,13 @@ get_prior_record_lsn(const char *archivedir, XLogRecPtr start_lsn,
|
||||
XLogRecPtr found;
|
||||
|
||||
GetXLogRecPtr(segno, 0, wal_seg_size, startpoint);
|
||||
|
||||
#if PG_VERSION_NUM >= 130000
|
||||
if (XLogRecPtrIsInvalid(startpoint))
|
||||
startpoint = SizeOfXLogShortPHD;
|
||||
XLogBeginRead(xlogreader, startpoint);
|
||||
#endif
|
||||
|
||||
found = XLogFindNextRecord(xlogreader, startpoint);
|
||||
|
||||
if (XLogRecPtrIsInvalid(found))
|
||||
@@ -1316,6 +1347,12 @@ XLogThreadWorker(void *arg)
|
||||
elog(ERROR, "Thread [%d]: out of memory", reader_data->thread_num);
|
||||
xlogreader->system_identifier = instance_config.system_identifier;
|
||||
|
||||
#if PG_VERSION_NUM >= 130000
|
||||
if (XLogRecPtrIsInvalid(thread_arg->startpoint))
|
||||
thread_arg->startpoint = SizeOfXLogShortPHD;
|
||||
XLogBeginRead(xlogreader, thread_arg->startpoint);
|
||||
#endif
|
||||
|
||||
found = XLogFindNextRecord(xlogreader, thread_arg->startpoint);
|
||||
|
||||
/*
|
||||
@@ -1853,9 +1890,6 @@ static XLogRecord* WalReadRecord(XLogReaderState *xlogreader, XLogRecPtr startpo
|
||||
{
|
||||
|
||||
#if PG_VERSION_NUM >= 130000
|
||||
// if (XLogRecPtrIsInvalid(startpoint))
|
||||
// startpoint = SizeOfXLogShortPHD;
|
||||
XLogBeginRead(xlogreader, startpoint);
|
||||
return XLogReadRecord(xlogreader, errormsg);
|
||||
#else
|
||||
return XLogReadRecord(xlogreader, startpoint, errormsg);
|
||||
|
||||
Reference in New Issue
Block a user