Skip to content

Commit 8a3dfd5

Browse files
committed
merge: honor the --no-fsync and --no-validate flags
1 parent 7b2f46c commit 8a3dfd5

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

src/pg_probackup.c

+9
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ bool compress_shortcut = false;
128128
/* other options */
129129
char *instance_name;
130130

131+
/* TODO: quick hack */
132+
bool merge_no_validate = false;
133+
bool merge_no_sync = false;
134+
131135
/* archive push options */
132136
int batch_size = 1;
133137
static char *wal_file_path;
@@ -830,6 +834,9 @@ main(int argc, char *argv[])
830834
case SHOW_CMD:
831835
return do_show(instance_name, current.backup_id, show_archive);
832836
case DELETE_CMD:
837+
merge_no_validate = no_validate;
838+
merge_no_sync = no_sync;
839+
833840
if (delete_expired && backup_id_string)
834841
elog(ERROR, "You cannot specify --delete-expired and (-i, --backup-id) options together");
835842
if (merge_expired && backup_id_string)
@@ -850,6 +857,8 @@ main(int argc, char *argv[])
850857
do_delete(current.backup_id);
851858
break;
852859
case MERGE_CMD:
860+
merge_no_validate = no_validate;
861+
merge_no_sync = no_sync;
853862
do_merge(current.backup_id);
854863
break;
855864
case SHOW_CONFIG_CMD:

src/pg_probackup.h

+4
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,10 @@ extern bool compress_shortcut;
784784
/* other options */
785785
extern char *instance_name;
786786

787+
/* temp merge options */
788+
extern bool merge_no_validate;
789+
extern bool merge_no_sync;
790+
787791
/* show options */
788792
extern ShowFormat show_format;
789793

src/utils/file.c

+3
Original file line numberDiff line numberDiff line change
@@ -1169,6 +1169,9 @@ int fio_sync(char const* path, fio_location location)
11691169
{
11701170
int fd;
11711171

1172+
if (merge_no_sync)
1173+
return 0;
1174+
11721175
fd = open(path, O_WRONLY | PG_BINARY, FILE_PERMISSIONS);
11731176
if (fd < 0)
11741177
return -1;

src/validate.c

+5
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ pgBackupValidate(pgBackup *backup, pgRestoreParams *params)
129129
// dbOid_exclude_list = get_dbOid_exclude_list(backup, files, params->partial_db_list,
130130
// params->partial_restore_type);
131131

132+
if (merge_no_validate)
133+
goto skip_validation;
134+
132135
/* setup threads */
133136
for (i = 0; i < parray_num(files); i++)
134137
{
@@ -180,6 +183,8 @@ pgBackupValidate(pgBackup *backup, pgRestoreParams *params)
180183
pfree(threads);
181184
pfree(threads_args);
182185

186+
skip_validation:
187+
183188
/* cleanup */
184189
parray_walk(files, pgFileFree);
185190
parray_free(files);

0 commit comments

Comments
 (0)