@@ -763,6 +763,19 @@ do_backup_instance(void)
763763 else
764764 elog (ERROR , "Data files transferring failed" );
765765
766+ /* Remove disappeared during backup files from backup_list */
767+ for (i = 0 ; i < parray_num (backup_files_list ); i ++ )
768+ {
769+ pgFile * tmp_file = (pgFile * ) parray_get (backup_files_list , i );
770+
771+ if (tmp_file -> write_size == FILE_NOT_FOUND )
772+ {
773+ pg_atomic_clear_flag (& tmp_file -> lock );
774+ pgFileFree (tmp_file );
775+ parray_remove (backup_files_list , i );
776+ }
777+ }
778+
766779 /* clean previous backup file list */
767780 if (prev_backup_filelist )
768781 {
@@ -2241,7 +2254,7 @@ backup_files(void *arg)
22412254 * If file is not found, this is not en error.
22422255 * It could have been deleted by concurrent postgres transaction.
22432256 */
2244- file -> write_size = BYTES_INVALID ;
2257+ file -> write_size = FILE_NOT_FOUND ;
22452258 elog (LOG , "File \"%s\" is not found" , file -> path );
22462259 continue ;
22472260 }
@@ -2291,7 +2304,9 @@ backup_files(void *arg)
22912304 instance_config .compress_alg ,
22922305 instance_config .compress_level ))
22932306 {
2294- file -> write_size = BYTES_INVALID ;
2307+ /* disappeared file not to be confused with 'not changed' */
2308+ if (file -> write_size != FILE_NOT_FOUND )
2309+ file -> write_size = BYTES_INVALID ;
22952310 elog (VERBOSE , "File \"%s\" was not copied to backup" , file -> path );
22962311 continue ;
22972312 }
@@ -2315,7 +2330,9 @@ backup_files(void *arg)
23152330 if (skip ||
23162331 !copy_file (arguments -> from_root , arguments -> to_root , file ))
23172332 {
2318- file -> write_size = BYTES_INVALID ;
2333+ /* disappeared file not to be confused with 'not changed' */
2334+ if (file -> write_size != FILE_NOT_FOUND )
2335+ file -> write_size = BYTES_INVALID ;
23192336 elog (VERBOSE , "File \"%s\" was not copied to backup" ,
23202337 file -> path );
23212338 continue ;
0 commit comments