File tree Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -315,20 +315,30 @@ validate_wal(pgBackup *backup,
315
315
316
316
free (backup_id );
317
317
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." );
322
335
323
336
/*
324
337
* Check if we have in archive all files needed to restore backup
325
338
* up to the given recovery target.
326
339
* In any case we cannot restore to the point before stop_lsn.
327
340
*/
328
- if (backup -> stream )
329
- private .archivedir = backup_xlog_path ;
330
- else
331
- private .archivedir = archivedir ;
341
+ private .archivedir = archivedir ;
332
342
333
343
private .tli = tli ;
334
344
xlogreader = XLogReaderAllocate (& SimpleXLogPageRead , & private );
You can’t perform that action at this time.
0 commit comments