@@ -210,6 +210,7 @@ do_restore_or_validate(time_t target_backup_id,
210210 /*
211211 * Validate backups from base_full_backup to dest_backup.
212212 * And restore if subcommand is RESTORE.
213+ * TODO what if we found out that backup is not valid?
213214 */
214215 for (i = base_full_backup_index ; i >= dest_backup_index ; i -- )
215216 {
@@ -270,6 +271,10 @@ restore_backup(pgBackup *backup)
270271 pthread_t restore_threads [num_threads ];
271272 restore_files_args * restore_threads_args [num_threads ];
272273
274+ if (backup -> status != BACKUP_STATUS_OK )
275+ elog (ERROR , "Backup %s cannot be restored because it is not valid" ,
276+ base36enc (backup -> start_time ));
277+
273278 /* confirm block size compatibility */
274279 if (backup -> block_size != BLCKSZ )
275280 elog (ERROR ,
@@ -541,7 +546,7 @@ restore_directories(const char *pg_data_dir, const char *backup_dir)
541546
542547/*
543548 * Check that all tablespace mapping entries have correct linked directory
544- * paths. Linked directories should be empty or do not exist.
549+ * paths. Linked directories must be empty or do not exist.
545550 *
546551 * If tablespace-mapping option is supplied all OLDDIR entries should have
547552 * entries in tablespace_map file.
@@ -561,7 +566,7 @@ check_tablespace_mapping(pgBackup *backup)
561566 pgBackupGetPath (backup , backup_path , lengthof (backup_path ), NULL );
562567 read_tablespace_map (links , backup_path );
563568
564- elog (LOG , "check tablespace directories..." );
569+ elog (LOG , "check tablespace directories of backup %s" , base36enc ( backup -> start_time ) );
565570
566571 /* 1 - OLDDIR should has an entry in links */
567572 for (cell = tablespace_dirs .head ; cell ; cell = cell -> next )
@@ -570,7 +575,7 @@ check_tablespace_mapping(pgBackup *backup)
570575
571576 if (parray_bsearch (links , tmp_file , pgFileCompareLinked ) == NULL )
572577 elog (ERROR , "--tablespace-mapping option's old directory "
573- "has not an entry in tablespace_map file: \"%s\"" ,
578+ "doesn't have an entry in tablespace_map file: \"%s\"" ,
574579 cell -> old_dir );
575580 }
576581
0 commit comments