@@ -849,7 +849,7 @@ merge_files(void *arg)
849
849
goto done ;
850
850
851
851
if (progress )
852
- elog (INFO , "Progress: (%d/%lu). Process file \"%s\"" ,
852
+ elog (INFO , "Progress: (%d/%lu). Merging file \"%s\"" ,
853
853
i + 1 , (unsigned long ) parray_num (arguments -> dest_backup -> files ), dest_file -> rel_path );
854
854
855
855
if (dest_file -> is_datafile && !dest_file -> is_cfs )
@@ -1111,14 +1111,28 @@ merge_data_file(parray *parent_chain, pgBackup *full_backup,
1111
1111
dest_backup -> compress_alg , dest_backup -> compress_level ,
1112
1112
dest_backup -> checksum_version , 0 , NULL , false);
1113
1113
1114
+ /* drop restored temp file */
1115
+ if (unlink (to_fullpath_tmp1 ) == -1 )
1116
+ elog (ERROR , "Cannot remove file \"%s\": %s" , to_fullpath_tmp1 ,
1117
+ strerror (errno ));
1118
+
1114
1119
/*
1115
1120
* In old (=<2.2.7) versions of pg_probackup n_blocks attribute of files
1116
1121
* in PAGE and PTRACK wasn`t filled.
1117
1122
*/
1118
- // Assert(tmp_file->n_blocks == dest_file->n_blocks);
1123
+ //Assert(tmp_file->n_blocks == dest_file->n_blocks);
1124
+
1125
+ /* Backward compatibility kludge:
1126
+ * When merging old backups, it is possible that
1127
+ * to_fullpath_tmp2 size will be 0, and so it will be
1128
+ * truncated in backup_data_file().
1129
+ * TODO: remove in 3.0.0
1130
+ */
1131
+ if (tmp_file -> write_size == 0 )
1132
+ return ;
1119
1133
1120
1134
if (fio_sync (to_fullpath_tmp2 , FIO_BACKUP_HOST ) != 0 )
1121
- elog (ERROR , "Cannot fsync merge temp file \"%s\": %s" ,
1135
+ elog (ERROR , "Cannot sync merge temp file \"%s\": %s" ,
1122
1136
to_fullpath_tmp2 , strerror (errno ));
1123
1137
1124
1138
/* Do atomic rename from second temp file to destination file */
@@ -1223,7 +1237,7 @@ merge_non_data_file(parray *parent_chain, pgBackup *full_backup,
1223
1237
1224
1238
/* TODO: --no-sync support */
1225
1239
if (fio_sync (to_fullpath_tmp , FIO_BACKUP_HOST ) != 0 )
1226
- elog (ERROR , "Cannot fsync merge temp file \"%s\": %s" ,
1240
+ elog (ERROR , "Cannot sync merge temp file \"%s\": %s" ,
1227
1241
to_fullpath_tmp , strerror (errno ));
1228
1242
1229
1243
/* Do atomic rename from second temp file to destination file */
0 commit comments