Skip to content

Commit 251e46c

Browse files
committed
[Issue #169] improve comments in merge
1 parent ac017dd commit 251e46c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/merge.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -427,13 +427,13 @@ merge_chain(parray *parent_chain, pgBackup *full_backup, pgBackup *dest_backup)
427427
/* for fancy reporting */
428428
time_t end_time;
429429
char pretty_time[20];
430-
/* in-place flags */
430+
/* in-place merge flags */
431431
bool compression_match = false;
432432
bool program_version_match = false;
433433
/* It's redundant to check block checksumms during merge */
434434
skip_block_validation = true;
435435

436-
/* Handle corner cases missing destination backup */
436+
/* Handle corner cases of missing destination backup */
437437
if (dest_backup == NULL &&
438438
full_backup->status == BACKUP_STATUS_MERGED)
439439
goto merge_rename;
@@ -740,12 +740,11 @@ merge_chain(parray *parent_chain, pgBackup *full_backup, pgBackup *dest_backup)
740740
}
741741

742742
/*
743-
* If we crash now, automatic rerun of failed merge will be impossible.
744-
* The user must have to manually change start_time of FULL backup
745-
* to start_time of destination backup:
746743
* PAGE2 DELETED
747744
* PAGE1 DELETED
748745
* FULL MERGED
746+
* If we crash now, automatic rerun of failed merge is still possible:
747+
* The user should start merge with full backup ID as an argument to option '-i'.
749748
*/
750749

751750
merge_rename:
@@ -891,7 +890,7 @@ merge_files(void *arg)
891890
*
892891
* Case 2:
893892
* in this case in place merge is possible:
894-
* 0 PAGE; file, size BYTES_INVALID (should not be possible)
893+
* 0 PAGE; file, size 0
895894
* 1 PAGE; file, size 0
896895
* 2 FULL; file, size 100500
897896
*
@@ -901,11 +900,11 @@ merge_files(void *arg)
901900
* 1 PAGE; file, size 100501
902901
* 2 FULL; file, size 100500
903902
*
904-
* Case 4:
903+
* Case 4 (good candidate for future optimization):
905904
* in this case in place merge is impossible:
906905
* 0 PAGE; file, size BYTES_INVALID
907906
* 1 PAGE; file, size 100501
908-
* 2 FULL; file, missing
907+
* 2 FULL; file, not exists yet
909908
*/
910909

911910
in_place = true;
@@ -1138,6 +1137,7 @@ merge_data_file(parray *parent_chain, pgBackup *full_backup,
11381137
if (tmp_file->write_size == 0)
11391138
return;
11401139

1140+
/* sync second temp file to disk */
11411141
if (fio_sync(to_fullpath_tmp2, FIO_BACKUP_HOST) != 0)
11421142
elog(ERROR, "Cannot sync merge temp file \"%s\": %s",
11431143
to_fullpath_tmp2, strerror(errno));
@@ -1242,7 +1242,7 @@ merge_non_data_file(parray *parent_chain, pgBackup *full_backup,
12421242
backup_non_data_file(tmp_file, NULL, from_fullpath,
12431243
to_fullpath_tmp, BACKUP_MODE_FULL, 0, false);
12441244

1245-
/* TODO: --no-sync support */
1245+
/* sync temp file to disk */
12461246
if (fio_sync(to_fullpath_tmp, FIO_BACKUP_HOST) != 0)
12471247
elog(ERROR, "Cannot sync merge temp file \"%s\": %s",
12481248
to_fullpath_tmp, strerror(errno));

0 commit comments

Comments
 (0)