This is an automated email from the ASF dual-hosted git repository.

laiyingchun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git


The following commit(s) were added to refs/heads/master by this push:
     new 7edbb2dfd feat(restore): Add 'restore_path' parameter for 'restore' 
command in Cpp CLI tool (#2008)
7edbb2dfd is described below

commit 7edbb2dfd808c6265c9f1a2ffba5a2abd25dc320
Author: Yingchun Lai <[email protected]>
AuthorDate: Mon May 27 11:59:30 2024 +0800

    feat(restore): Add 'restore_path' parameter for 'restore' command in Cpp 
CLI tool (#2008)
---
 src/client/replication_ddl_client.h             |  2 +-
 src/shell/commands/cold_backup.cpp              | 10 ++++++++--
 src/shell/main.cpp                              |  3 ++-
 src/test/function_test/restore/test_restore.cpp |  3 ++-
 4 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/client/replication_ddl_client.h 
b/src/client/replication_ddl_client.h
index 69b3ae571..12710e785 100644
--- a/src/client/replication_ddl_client.h
+++ b/src/client/replication_ddl_client.h
@@ -162,7 +162,7 @@ public:
                                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);
 
diff --git a/src/shell/commands/cold_backup.cpp 
b/src/shell/commands/cold_backup.cpp
index ba159c4ce..4dfd41473 100644
--- a/src/shell/commands/cold_backup.cpp
+++ b/src/shell/commands/cold_backup.cpp
@@ -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;
@@ -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) {
@@ -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;
@@ -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());
     }
diff --git a/src/shell/main.cpp b/src/shell/main.cpp
index 3b279824c..4b4934eed 100644
--- a/src/shell/main.cpp
+++ b/src/shell/main.cpp
@@ -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,
     },
     {
diff --git a/src/test/function_test/restore/test_restore.cpp 
b/src/test/function_test/restore/test_restore.cpp
index 42e13161a..fc4259357 100644
--- a/src/test/function_test/restore/test_restore.cpp
+++ b/src/test/function_test/restore/test_restore.cpp
@@ -78,7 +78,8 @@ public:
                                           table_name_,
                                           table_id_,
                                           kNewTableName,
-                                          false));
+                                          false,
+                                          ""));
         NO_FATALS(wait_table_healthy(kNewTableName));
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to