empiredan commented on code in PR #1960:
URL:
https://github.com/apache/incubator-pegasus/pull/1960#discussion_r1540429491
##########
src/shell/commands/duplication.cpp:
##########
@@ -80,35 +81,55 @@ bool add_dup(command_executor *e, shell_context *sc,
arguments args)
return true;
}
+ // Check if the boolean option is specified.
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();
+
+ // Read the app name of the remote cluster, if any.
+ // Otherwise, use app_name as the remote_app_name.
+ std::string remote_app_name(cmd({"-a", "--remote_app_name"},
app_name).str());
+
+ auto err_resp = sc->ddl_client->add_dup(
+ app_name, remote_cluster_name, is_duplicating_checkpoint,
remote_app_name);
+ auto err = err_resp.get_error();
std::string hint;
- if (err.is_ok()) {
+ if (err) {
err = dsn::error_s::make(err_resp.get_value().err);
hint = err_resp.get_value().hint;
}
- if (!err.is_ok()) {
+
+ if (!err) {
fmt::print(stderr,
"adding duplication failed [app: {}, remote: {},
checkpoint: {}, error: {}]\n",
app_name,
remote_cluster_name,
is_duplicating_checkpoint,
- err.description());
+ err);
+
if (!hint.empty()) {
fmt::print(stderr, "detail:\n {}\n", hint);
}
+
+ return true;
+ }
+
+ const auto &resp = err_resp.get_value();
+ fmt::print("adding duplication succeed [app: {}, remote: {}, appid: {},
dupid: "
+ "{}], checkpoint: {}",
+ app_name,
+ remote_cluster_name,
+ resp.appid,
+ resp.dupid,
+ is_duplicating_checkpoint);
+
+ if (resp.__isset.remote_app_name) {
+ fmt::print(", remote_app_name: {}\n", remote_app_name);
} else {
- const auto &resp = err_resp.get_value();
- fmt::print("adding duplication succeed [app: {}, remote: {}, appid:
{}, dupid: "
- "{}], checkpoint: {}\n",
- app_name,
- remote_cluster_name,
- resp.appid,
- resp.dupid,
- is_duplicating_checkpoint);
+ fmt::print("\nWARNING: meta server does NOT support specifying
remote_app_name, "
+ "remote_app_name might has been specified with {}\n",
+ remote_app_name,
+ app_name);
Review Comment:
This is a bug, where `remote_app_name` should be removed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]