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

yuchenhe 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 a50db485 feat(dup_enhancement#25): add `-s | --sst` argument to 
support ignoring checkpoint when duplicate (#940)
a50db485 is described below

commit a50db4851e1d939289b6d09b23d3e3479681843a
Author: Jiashuo <[email protected]>
AuthorDate: Fri Apr 8 15:49:43 2022 +0800

    feat(dup_enhancement#25): add `-s | --sst` argument to support ignoring 
checkpoint when duplicate (#940)
---
 rdsn                               |  2 +-
 src/shell/commands/duplication.cpp | 19 +++++++++++++++----
 src/shell/main.cpp                 |  2 +-
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/rdsn b/rdsn
index ea921061..7f02509f 160000
--- a/rdsn
+++ b/rdsn
@@ -1 +1 @@
-Subproject commit ea9210614ac5cac42cd3f8b8e1aedd68981b37de
+Subproject commit 7f02509f2cc6d66b6d27b22592607fbcbfc01ce7
diff --git a/src/shell/commands/duplication.cpp 
b/src/shell/commands/duplication.cpp
index 862f4c3f..370bb1fa 100644
--- a/src/shell/commands/duplication.cpp
+++ b/src/shell/commands/duplication.cpp
@@ -39,6 +39,13 @@ bool add_dup(command_executor *e, shell_context *sc, 
arguments args)
         return false;
     }
 
+    for (const auto &flag : cmd.flags()) {
+        if (dsn_unlikely(flag != "s" && flag != "sst")) {
+            fmt::print(stderr, "unknown flag {}\n", flag);
+            return false;
+        }
+    }
+
     if (!cmd(1)) {
         fmt::print(stderr, "missing param <app_name>\n");
         return false;
@@ -57,7 +64,9 @@ bool add_dup(command_executor *e, shell_context *sc, 
arguments args)
         return true;
     }
 
-    auto err_resp = sc->ddl_client->add_dup(app_name, remote_cluster_name);
+    bool is_duplicating_checkpoint = cmd[{"-s", "--sst"}];
+    auto err_resp =
+        sc->ddl_client->add_dup(app_name, remote_cluster_name, 
is_duplicating_checkpoint);
     dsn::error_s err = err_resp.get_error();
     std::string hint;
     if (err.is_ok()) {
@@ -66,9 +75,10 @@ bool add_dup(command_executor *e, shell_context *sc, 
arguments args)
     }
     if (!err.is_ok()) {
         fmt::print(stderr,
-                   "adding duplication failed [app: {}, remote: {}, error: 
{}]\n",
+                   "adding duplication failed [app: {}, remote: {}, 
checkpoint: {}, error: {}]\n",
                    app_name,
                    remote_cluster_name,
+                   is_duplicating_checkpoint,
                    err.description());
         if (!hint.empty()) {
             fmt::print(stderr, "detail:\n  {}\n", hint);
@@ -76,11 +86,12 @@ bool add_dup(command_executor *e, shell_context *sc, 
arguments args)
     } else {
         const auto &resp = err_resp.get_value();
         fmt::print("adding duplication succeed [app: {}, remote: {}, appid: 
{}, dupid: "
-                   "{}]\n",
+                   "{}], checkpoint: {}\n",
                    app_name,
                    remote_cluster_name,
                    resp.appid,
-                   resp.dupid);
+                   resp.dupid,
+                   is_duplicating_checkpoint);
     }
     return true;
 }
diff --git a/src/shell/main.cpp b/src/shell/main.cpp
index b1fa1f51..e761fd08 100644
--- a/src/shell/main.cpp
+++ b/src/shell/main.cpp
@@ -449,7 +449,7 @@ static command_executor commands[] = {
         "[-s|--skip_prompt] [-o|--output file_name]",
         ddd_diagnose,
     },
-    {"add_dup", "add duplication", "<app_name> <remote_cluster_name>", 
add_dup},
+    {"add_dup", "add duplication", "<app_name> <remote_cluster_name> 
[-s|--sst]", add_dup},
     {"query_dup", "query duplication info", "<app_name> [-d|--detail]", 
query_dup},
     {"remove_dup", "remove duplication", "<app_name> <dup_id>", remove_dup},
     {"start_dup", "start duplication", "<app_name> <dup_id>", start_dup},


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

Reply via email to