@@ -315,20 +315,30 @@ validate_wal(pgBackup *backup,
315315
316316free (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
333343private .tli = tli ;
334344xlogreader = XLogReaderAllocate (& SimpleXLogPageRead ,& private );