mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2024-11-28 09:33:54 +02:00
Check ptrack control file.
This commit is contained in:
parent
633b4b5c55
commit
30845bf4a6
6
backup.c
6
backup.c
@ -230,6 +230,12 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
|
||||
|
||||
if (current.backup_mode == BACKUP_MODE_DIFF_PTRACK)
|
||||
{
|
||||
XLogRecPtr ptrack_lsn = get_last_ptrack_lsn();
|
||||
if (ptrack_lsn < prev_backup->start_lsn || ptrack_lsn >= current.start_lsn)
|
||||
elog(ERROR, "Wrong ptrack lsn:%lx prev:%lx current:%lx",
|
||||
ptrack_lsn,
|
||||
prev_backup->start_lsn,
|
||||
current.start_lsn);
|
||||
parray_qsort(backup_files_list, pgFileComparePathDesc);
|
||||
make_pagemap_from_ptrack(backup_files_list);
|
||||
}
|
||||
|
@ -107,11 +107,9 @@ SimpleXLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr,
|
||||
{
|
||||
XLogPageReadPrivate *private = (XLogPageReadPrivate *) xlogreader->private_data;
|
||||
uint32 targetPageOff;
|
||||
XLogRecPtr targetSegEnd;
|
||||
XLogSegNo targetSegNo;
|
||||
|
||||
XLByteToSeg(targetPagePtr, targetSegNo);
|
||||
XLogSegNoOffsetToRecPtr(targetSegNo + 1, 0, targetSegEnd);
|
||||
targetPageOff = targetPagePtr % XLogSegSize;
|
||||
|
||||
/*
|
||||
|
@ -298,6 +298,7 @@ extern void time2iso(char *buf, size_t len, time_t time);
|
||||
extern const char *status2str(BackupStatus status);
|
||||
extern void remove_trailing_space(char *buf, int comment_mark);
|
||||
extern void remove_not_digit(char *buf, size_t len, const char *str);
|
||||
extern XLogRecPtr get_last_ptrack_lsn(void);
|
||||
|
||||
/* in status.c */
|
||||
extern bool is_pg_running(void);
|
||||
|
15
util.c
15
util.c
@ -75,6 +75,21 @@ sanityChecks(void)
|
||||
"target master need to use either data checksums or \"wal_log_hints = on\".");
|
||||
}
|
||||
|
||||
XLogRecPtr
|
||||
get_last_ptrack_lsn(void)
|
||||
{
|
||||
char *buffer;
|
||||
size_t size;
|
||||
XLogRecPtr lsn;
|
||||
|
||||
buffer = slurpFile(pgdata, "global/ptrack_control", &size, false);
|
||||
if (buffer == NULL)
|
||||
return 0;
|
||||
|
||||
lsn = *(XLogRecPtr *)buffer;
|
||||
return lsn;
|
||||
}
|
||||
|
||||
/*
|
||||
* Utility shared by backup and restore to fetch the current timeline
|
||||
* used by a node.
|
||||
|
Loading…
Reference in New Issue
Block a user