mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-04-13 12:00:41 +02:00
[Issue #169] improve comments in merge
This commit is contained in:
parent
ac017dd8da
commit
251e46c2ab
18
src/merge.c
18
src/merge.c
@ -427,13 +427,13 @@ merge_chain(parray *parent_chain, pgBackup *full_backup, pgBackup *dest_backup)
|
|||||||
/* for fancy reporting */
|
/* for fancy reporting */
|
||||||
time_t end_time;
|
time_t end_time;
|
||||||
char pretty_time[20];
|
char pretty_time[20];
|
||||||
/* in-place flags */
|
/* in-place merge flags */
|
||||||
bool compression_match = false;
|
bool compression_match = false;
|
||||||
bool program_version_match = false;
|
bool program_version_match = false;
|
||||||
/* It's redundant to check block checksumms during merge */
|
/* It's redundant to check block checksumms during merge */
|
||||||
skip_block_validation = true;
|
skip_block_validation = true;
|
||||||
|
|
||||||
/* Handle corner cases missing destination backup */
|
/* Handle corner cases of missing destination backup */
|
||||||
if (dest_backup == NULL &&
|
if (dest_backup == NULL &&
|
||||||
full_backup->status == BACKUP_STATUS_MERGED)
|
full_backup->status == BACKUP_STATUS_MERGED)
|
||||||
goto merge_rename;
|
goto merge_rename;
|
||||||
@ -740,12 +740,11 @@ merge_delete:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we crash now, automatic rerun of failed merge will be impossible.
|
|
||||||
* The user must have to manually change start_time of FULL backup
|
|
||||||
* to start_time of destination backup:
|
|
||||||
* PAGE2 DELETED
|
* PAGE2 DELETED
|
||||||
* PAGE1 DELETED
|
* PAGE1 DELETED
|
||||||
* FULL MERGED
|
* FULL MERGED
|
||||||
|
* If we crash now, automatic rerun of failed merge is still possible:
|
||||||
|
* The user should start merge with full backup ID as an argument to option '-i'.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
merge_rename:
|
merge_rename:
|
||||||
@ -891,7 +890,7 @@ merge_files(void *arg)
|
|||||||
*
|
*
|
||||||
* Case 2:
|
* Case 2:
|
||||||
* in this case in place merge is possible:
|
* in this case in place merge is possible:
|
||||||
* 0 PAGE; file, size BYTES_INVALID (should not be possible)
|
* 0 PAGE; file, size 0
|
||||||
* 1 PAGE; file, size 0
|
* 1 PAGE; file, size 0
|
||||||
* 2 FULL; file, size 100500
|
* 2 FULL; file, size 100500
|
||||||
*
|
*
|
||||||
@ -901,11 +900,11 @@ merge_files(void *arg)
|
|||||||
* 1 PAGE; file, size 100501
|
* 1 PAGE; file, size 100501
|
||||||
* 2 FULL; file, size 100500
|
* 2 FULL; file, size 100500
|
||||||
*
|
*
|
||||||
* Case 4:
|
* Case 4 (good candidate for future optimization):
|
||||||
* in this case in place merge is impossible:
|
* in this case in place merge is impossible:
|
||||||
* 0 PAGE; file, size BYTES_INVALID
|
* 0 PAGE; file, size BYTES_INVALID
|
||||||
* 1 PAGE; file, size 100501
|
* 1 PAGE; file, size 100501
|
||||||
* 2 FULL; file, missing
|
* 2 FULL; file, not exists yet
|
||||||
*/
|
*/
|
||||||
|
|
||||||
in_place = true;
|
in_place = true;
|
||||||
@ -1138,6 +1137,7 @@ merge_data_file(parray *parent_chain, pgBackup *full_backup,
|
|||||||
if (tmp_file->write_size == 0)
|
if (tmp_file->write_size == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* sync second temp file to disk */
|
||||||
if (fio_sync(to_fullpath_tmp2, FIO_BACKUP_HOST) != 0)
|
if (fio_sync(to_fullpath_tmp2, FIO_BACKUP_HOST) != 0)
|
||||||
elog(ERROR, "Cannot sync merge temp file \"%s\": %s",
|
elog(ERROR, "Cannot sync merge temp file \"%s\": %s",
|
||||||
to_fullpath_tmp2, strerror(errno));
|
to_fullpath_tmp2, strerror(errno));
|
||||||
@ -1242,7 +1242,7 @@ merge_non_data_file(parray *parent_chain, pgBackup *full_backup,
|
|||||||
backup_non_data_file(tmp_file, NULL, from_fullpath,
|
backup_non_data_file(tmp_file, NULL, from_fullpath,
|
||||||
to_fullpath_tmp, BACKUP_MODE_FULL, 0, false);
|
to_fullpath_tmp, BACKUP_MODE_FULL, 0, false);
|
||||||
|
|
||||||
/* TODO: --no-sync support */
|
/* sync temp file to disk */
|
||||||
if (fio_sync(to_fullpath_tmp, FIO_BACKUP_HOST) != 0)
|
if (fio_sync(to_fullpath_tmp, FIO_BACKUP_HOST) != 0)
|
||||||
elog(ERROR, "Cannot sync merge temp file \"%s\": %s",
|
elog(ERROR, "Cannot sync merge temp file \"%s\": %s",
|
||||||
to_fullpath_tmp, strerror(errno));
|
to_fullpath_tmp, strerror(errno));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user