1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2024-11-25 09:01:48 +02:00

[Issue #118]: trust txid_snapshot_xmax() when determining recovery_xid

This commit is contained in:
Grigory Smolkin 2019-09-16 13:47:24 +03:00
parent 2413516389
commit 11ab44fb04
3 changed files with 4 additions and 6 deletions

View File

@ -2019,6 +2019,7 @@ pg_stop_backup(pgBackup *backup, PGconn *pg_startbackup_conn,
xlog_path = arclog_path;
backup->stop_lsn = stop_backup_lsn;
backup->recovery_xid = recovery_xid;
elog(LOG, "Getting the Recovery Time from WAL");
@ -2026,11 +2027,10 @@ pg_stop_backup(pgBackup *backup, PGconn *pg_startbackup_conn,
if (!read_recovery_info(xlog_path, backup->tli,
instance_config.xlog_seg_size,
backup->start_lsn, backup->stop_lsn,
&backup->recovery_time, &backup->recovery_xid))
&backup->recovery_time))
{
elog(LOG, "Failed to find Recovery Time in WAL, forced to trust current_timestamp");
backup->recovery_time = recovery_time;
backup->recovery_xid = recovery_xid;
}
}
}

View File

@ -425,7 +425,7 @@ validate_wal(pgBackup *backup, const char *archivedir,
bool
read_recovery_info(const char *archivedir, TimeLineID tli, uint32 wal_seg_size,
XLogRecPtr start_lsn, XLogRecPtr stop_lsn,
time_t *recovery_time, TransactionId *recovery_xid)
time_t *recovery_time)
{
XLogRecPtr startpoint = stop_lsn;
XLogReaderState *xlogreader;
@ -472,7 +472,6 @@ read_recovery_info(const char *archivedir, TimeLineID tli, uint32 wal_seg_size,
if (getRecordTimestamp(xlogreader, &last_time))
{
*recovery_time = timestamptz_to_time_t(last_time);
*recovery_xid = XLogRecGetXid(xlogreader);
/* Found timestamp in WAL record 'record' */
res = true;

View File

@ -707,8 +707,7 @@ extern void validate_wal(pgBackup *backup, const char *archivedir,
extern bool read_recovery_info(const char *archivedir, TimeLineID tli,
uint32 seg_size,
XLogRecPtr start_lsn, XLogRecPtr stop_lsn,
time_t *recovery_time,
TransactionId *recovery_xid);
time_t *recovery_time);
extern bool wal_contains_lsn(const char *archivedir, XLogRecPtr target_lsn,
TimeLineID target_tli, uint32 seg_size);
extern XLogRecPtr get_prior_record_lsn(const char *archivedir, XLogRecPtr start_lsn,