1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-01-09 14:45:47 +02:00

Fixes for validate_wal().

For stream backup check only WAL segments from start_lsn to stop_lsn.
If recovery target is provided check that we can restore backup to a
recoverty target time or xid.
This commit is contained in:
Arthur Zakirov 2017-06-15 15:52:08 +03:00
parent b3aa4cf086
commit ac4519e33c

View File

@ -315,20 +315,27 @@ validate_wal(pgBackup *backup,
free(backup_id);
/* If recovery target is provided, ensure that archive exists. */
if (dir_is_empty(archivedir)
&& (TransactionIdIsValid(target_xid) || target_time != 0))
elog(ERROR, "WAL archive is empty. You cannot restore backup to a recovery target without WAL archive.");
/*
* If recovery target is provided check that we can restore backup to a
* recoverty target time or xid.
*/
if (!TransactionIdIsValid(target_xid) || target_time == 0)
/* Recoverty target is not given so exit */
return;
/*
* If recovery target is provided, ensure that archive files exist in
* archive directory.
*/
if (dir_is_empty(archivedir))
elog(ERROR, "WAL archive is empty. You cannot restore backup to a recovery target without WAL archive.");
/*
* Check if we have in archive all files needed to restore backup
* up to the given recovery target.
* In any case we cannot restore to the point before stop_lsn.
*/
if (backup->stream)
private.archivedir = backup_xlog_path;
else
private.archivedir = archivedir;
private.archivedir = archivedir;
private.tli = tli;
xlogreader = XLogReaderAllocate(&SimpleXLogPageRead, &private);