Skip to content

Commit aaa8941

Browse files
committed
Merge branch 'master' of git.postgrespro.ru:pgpro-dev/pg_probackup
2 parents 41bdaf6 + e949d7f commit aaa8941

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

parsexlog.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -315,20 +315,30 @@ validate_wal(pgBackup *backup,
315315

316316
free(backup_id);
317317

318-
/* If recovery target is provided, ensure that archive exists. */
319-
if (dir_is_empty(archivedir)
320-
&& (TransactionIdIsValid(target_xid) || target_time != 0))
321-
elog(ERROR, "WAL archive is empty. You cannot restore backup to a recovery target without WAL archive.");
318+
/*
319+
* If recovery target is provided check that we can restore backup to a
320+
* recoverty target time or xid.
321+
*/
322+
if (!TransactionIdIsValid(target_xid) || target_time == 0)
323+
{
324+
/* Recoverty target is not given so exit */
325+
elog(INFO, "backup validation completed successfully");
326+
return;
327+
}
328+
329+
/*
330+
* If recovery target is provided, ensure that archive files exist in
331+
* archive directory.
332+
*/
333+
if (dir_is_empty(archivedir))
334+
elog(ERROR, "WAL archive is empty. You cannot restore backup to a recovery target without WAL archive.");
322335

323336
/*
324337
* Check if we have in archive all files needed to restore backup
325338
* up to the given recovery target.
326339
* In any case we cannot restore to the point before stop_lsn.
327340
*/
328-
if (backup->stream)
329-
private.archivedir = backup_xlog_path;
330-
else
331-
private.archivedir = archivedir;
341+
private.archivedir = archivedir;
332342

333343
private.tli = tli;
334344
xlogreader = XLogReaderAllocate(&SimpleXLogPageRead, &private);

0 commit comments

Comments
 (0)