Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(restore): Add 'restore_path' parameter for 'restore' command in Cpp CLI tool #2008

Merged
merged 2 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/client/replication_ddl_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class replication_ddl_client
int32_t old_app_id,
const std::string &new_app_name,
bool skip_bad_partition,
const std::string &restore_path = "");
const std::string &restore_path);

dsn::error_code query_restore(int32_t restore_app_id, bool detailed);

Expand Down
10 changes: 8 additions & 2 deletions src/shell/commands/cold_backup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,13 @@ bool restore(command_executor *e, shell_context *sc, arguments args)
{"new_app_name", required_argument, 0, 'n'},
{"timestamp", required_argument, 0, 't'},
{"backup_provider_type", required_argument, 0, 'b'},
{"restore_path", required_argument, 0, 'r'},
{"skip_bad_partition", no_argument, 0, 's'},
{0, 0, 0, 0}};
std::string old_cluster_name, old_policy_name;
std::string old_app_name, new_app_name;
std::string backup_provider_type;
std::string restore_path;
int32_t old_app_id = 0;
int64_t timestamp = 0;
bool skip_bad_partition = false;
Expand All @@ -400,7 +402,7 @@ bool restore(command_executor *e, shell_context *sc, arguments args)
while (true) {
int option_index = 0;
int c;
c = getopt_long(args.argc, args.argv, "c:p:a:i:n:t:b:s", long_options, &option_index);
c = getopt_long(args.argc, args.argv, "c:p:a:i:n:t:b:r:s", long_options, &option_index);
if (c == -1)
break;
switch (c) {
Expand All @@ -425,6 +427,9 @@ bool restore(command_executor *e, shell_context *sc, arguments args)
case 'b':
backup_provider_type = optarg;
break;
case 'r':
restore_path = optarg;
break;
case 's':
skip_bad_partition = true;
break;
Expand Down Expand Up @@ -452,7 +457,8 @@ bool restore(command_executor *e, shell_context *sc, arguments args)
old_app_name,
old_app_id,
new_app_name,
skip_bad_partition);
skip_bad_partition,
restore_path);
if (err != ::dsn::ERR_OK) {
fprintf(stderr, "restore app failed with err(%s)\n", err.to_string());
}
Expand Down
3 changes: 2 additions & 1 deletion src/shell/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,8 @@ static command_executor commands[] = {
"restore app from backup media",
"<-c|--old_cluster_name str> <-p|--old_policy_name str> <-a|--old_app_name str> "
"<-i|--old_app_id id> <-t|--timestamp/backup_id timestamp> "
"<-b|--backup_provider_type str> [-n|--new_app_name str] [-s|--skip_bad_partition]",
"<-b|--backup_provider_type str> [-n|--new_app_name str] [-s|--skip_bad_partition] "
"[-r|--restore_path str]",
restore,
},
{
Expand Down
3 changes: 2 additions & 1 deletion src/test/function_test/restore/test_restore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ class restore_test : public test_util
table_name_,
table_id_,
kNewTableName,
false));
false,
""));
NO_FATALS(wait_table_healthy(kNewTableName));
}

Expand Down
Loading