diff --git a/src/help.c b/src/help.c index 4aea75ea..8c2cf18b 100644 --- a/src/help.c +++ b/src/help.c @@ -131,6 +131,7 @@ help_pg_probackup(void) printf(_(" [--restore-as-replica]\n")); printf(_(" [--no-validate]\n")); printf(_(" [--skip-block-validation]\n")); + printf(_(" [--skip-external-dirs]\n")); printf(_("\n %s validate -B backup-path [--instance=instance_name]\n"), PROGRAM_NAME); printf(_(" [-i backup-id] [--progress]\n")); @@ -290,7 +291,8 @@ help_restore(void) printf(_(" [--immediate] [--recovery-target-name=target-name]\n")); printf(_(" [--recovery-target-action=pause|promote|shutdown]\n")); printf(_(" [--restore-as-replica] [--no-validate]\n")); - printf(_(" [--skip-block-validation]\n\n")); + printf(_(" [--skip-block-validation]\n")); + printf(_(" [--skip-external-dirs]\n\n")); printf(_(" -B, --backup-path=backup-path location of the backup storage area\n")); printf(_(" --instance=instance_name name of the instance\n")); @@ -320,6 +322,7 @@ help_restore(void) printf(_(" to ease setting up a standby server\n")); printf(_(" --no-validate disable backup validation during restore\n")); printf(_(" --skip-block-validation set to validate only file-level checksum\n")); + printf(_(" --skip-external-dirs do not restore all external directories\n")); printf(_("\n Logging options:\n")); printf(_(" --log-level-console=log-level-console\n")); diff --git a/src/pg_probackup.c b/src/pg_probackup.c index d5b51df3..2677ab52 100644 --- a/src/pg_probackup.c +++ b/src/pg_probackup.c @@ -86,6 +86,7 @@ bool restore_as_replica = false; bool restore_no_validate = false; bool skip_block_validation = false; +bool skip_external_dirs = false; /* delete options */ bool delete_wal = false; @@ -153,6 +154,7 @@ static ConfigOption cmd_options[] = { 'b', 143, "no-validate", &restore_no_validate, SOURCE_CMD_STRICT }, { 's', 144, "lsn", &target_lsn, SOURCE_CMD_STRICT }, { 'b', 154, "skip-block-validation", &skip_block_validation, SOURCE_CMD_STRICT }, + { 'b', 156, "skip-external-dirs", &skip_external_dirs, SOURCE_CMD_STRICT }, /* delete options */ { 'b', 145, "wal", &delete_wal, SOURCE_CMD_STRICT }, { 'b', 146, "expired", &delete_expired, SOURCE_CMD_STRICT }, diff --git a/src/pg_probackup.h b/src/pg_probackup.h index b435b427..2388a203 100644 --- a/src/pg_probackup.h +++ b/src/pg_probackup.h @@ -375,6 +375,7 @@ extern bool exclusive_backup; /* restore options */ extern bool restore_as_replica; extern bool skip_block_validation; +extern bool skip_external_dirs; /* delete options */ extern bool delete_wal; diff --git a/src/restore.c b/src/restore.c index 97505075..0d10ac35 100644 --- a/src/restore.c +++ b/src/restore.c @@ -480,7 +480,7 @@ restore_backup(pgBackup *backup, const char *external_dir_str) pgBackupGetPath(backup, this_backup_path, lengthof(this_backup_path), NULL); create_data_directories(instance_config.pgdata, this_backup_path, true); - if(external_dir_str) + if(external_dir_str && !skip_external_dirs) { requested_external_dirs = make_external_directory_list(external_dir_str); for (i = 0; i < parray_num(requested_external_dirs); i++) @@ -514,7 +514,7 @@ restore_backup(pgBackup *backup, const char *external_dir_str) { pgFile *file = (pgFile *) parray_get(files, i); - /* if the entry was an external directory, create it in the backup */ + /* If the entry was an external directory, create it in the backup */ if (file->external_dir_num && S_ISDIR(file->mode)) { char dirpath[MAXPGPATH];