521521backup_data_file (backup_files_arg * arguments ,
522522const char * to_path ,pgFile * file ,
523523XLogRecPtr prev_backup_start_lsn ,BackupMode backup_mode ,
524- CompressAlg calg ,int clevel )
524+ CompressAlg calg ,int clevel , bool missing_ok )
525525{
526526FILE * in ;
527527FILE * out ;
@@ -567,9 +567,14 @@ backup_data_file(backup_files_arg* arguments,
567567 */
568568if (errno == ENOENT )
569569{
570- elog (LOG ,"File \"%s\" is not found" ,file -> path );
571- file -> write_size = FILE_NOT_FOUND ;
572- return false;
570+ if (missing_ok )
571+ {
572+ elog (LOG ,"File \"%s\" is not found" ,file -> path );
573+ file -> write_size = FILE_NOT_FOUND ;
574+ return false;
575+ }
576+ else
577+ elog (ERROR ,"File \"%s\" is not found" ,file -> path );
573578}
574579
575580elog (ERROR ,"cannot open file \"%s\": %s" ,
@@ -754,7 +759,7 @@ restore_data_file(const char *to_path, pgFile *file, bool allow_truncate,
754759break ;
755760
756761/*
757- * We need to truncate result file if data file ina incremental backup
762+ * We need to truncate result file if data file inan incremental backup
758763 * less than data file in a full backup. We know it thanks to n_blocks.
759764 *
760765 * It may be equal to -1, then we don't want to truncate the result
@@ -939,7 +944,7 @@ restore_data_file(const char *to_path, pgFile *file, bool allow_truncate,
939944 */
940945bool
941946copy_file (fio_location from_location ,const char * to_root ,
942- fio_location to_location ,pgFile * file )
947+ fio_location to_location ,pgFile * file , bool missing_ok )
943948{
944949char to_path [MAXPGPATH ];
945950FILE * in ;
@@ -963,12 +968,17 @@ copy_file(fio_location from_location, const char *to_root,
963968FIN_FILE_CRC32 (true,crc );
964969file -> crc = crc ;
965970
966- /* maybe deleted, it's not error */
971+ /* maybe deleted, it's not errorin case of backup */
967972if (errno == ENOENT )
968973{
969- elog (LOG ,"File \"%s\" is not found" ,file -> path );
970- file -> write_size = FILE_NOT_FOUND ;
971- return false;
974+ if (missing_ok )
975+ {
976+ elog (LOG ,"File \"%s\" is not found" ,file -> path );
977+ file -> write_size = FILE_NOT_FOUND ;
978+ return false;
979+ }
980+ else
981+ elog (ERROR ,"File \"%s\" is not found" ,file -> path );
972982}
973983
974984elog (ERROR ,"cannot open source file \"%s\": %s" ,file -> path ,