@@ -91,31 +91,6 @@ write_backup_status(pgBackup *backup, BackupStatus status)
9191 pgBackupFree (tmp );
9292}
9393
94- /* update some fields of backup control file */
95- void
96- write_backup_control_on_the_fly (pgBackup * backup )
97- {
98- pgBackup * tmp ;
99-
100- tmp = read_backup (backup -> start_time );
101- if (!tmp )
102- {
103- /*
104- * Silently exit the function, since read_backup already logged the
105- * warning message.
106- */
107- return ;
108- }
109-
110- tmp -> status = backup -> status ;
111- tmp -> data_bytes = backup -> data_bytes ;
112- backup -> duration = difftime (time (NULL ), backup -> start_time );
113- tmp -> duration = backup -> duration ;
114- write_backup (tmp );
115-
116- pgBackupFree (tmp );
117- }
118-
11994/*
12095 * Create exclusive lockfile in the backup's directory.
12196 */
@@ -610,8 +585,6 @@ pgBackupWriteControl(FILE *out, pgBackup *backup)
610585 /* print external directories list */
611586 if (backup -> external_dir_str )
612587 fio_fprintf (out , "external-dirs = '%s'\n" , backup -> external_dir_str );
613-
614- fio_fprintf (out , "duration = " INT64_FORMAT "\n" , backup -> duration );
615588}
616589
617590/*
@@ -687,11 +660,10 @@ write_backup_filelist(pgBackup *backup, parray *files, const char *root,
687660
688661 i ++ ;
689662
663+ /* if file is not backuped yet, do not add it to the list */
664+ /* TODO check that we correctly handle files which disappeared during backups */
690665 if (!file -> backuped )
691- {
692- elog (WARNING , "file not backuped %s" , file -> rel_path );
693666 continue ;
694- }
695667
696668 if (S_ISDIR (file -> mode ))
697669 backup_size_on_disk += 4096 ;
@@ -778,7 +750,7 @@ write_backup_filelist(pgBackup *backup, parray *files, const char *root,
778750
779751 /* use extra variable to avoid reset of previous data_bytes value in case of error */
780752 backup -> data_bytes = backup_size_on_disk ;
781- write_backup_control_on_the_fly (backup );
753+ write_backup (backup );
782754}
783755
784756/*
@@ -826,7 +798,6 @@ readBackupControlFile(const char *path)
826798 {'b' , 0 , "from-replica" , & backup -> from_replica , SOURCE_FILE_STRICT },
827799 {'s' , 0 , "primary-conninfo" , & backup -> primary_conninfo , SOURCE_FILE_STRICT },
828800 {'s' , 0 , "external-dirs" , & backup -> external_dir_str , SOURCE_FILE_STRICT },
829- {'I' , 0 , "duration" , & backup -> duration , SOURCE_FILE_STRICT },
830801 {0 }
831802 };
832803
@@ -1058,8 +1029,6 @@ pgBackupInit(pgBackup *backup)
10581029 backup -> program_version [0 ] = '\0' ;
10591030 backup -> server_version [0 ] = '\0' ;
10601031 backup -> external_dir_str = NULL ;
1061-
1062- backup -> duration = (time_t ) 0 ;
10631032}
10641033
10651034/* free pgBackup object */
0 commit comments