This is an automated email from the ASF dual-hosted git repository.
wutao 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 544a4f6 fix(hotkey): fix input and output of detect_hotkey in shell
(#710)
544a4f6 is described below
commit 544a4f626b0d7f1a33b57d2ce0f18066f1bb04b8
Author: Smilencer <[email protected]>
AuthorDate: Wed Apr 7 10:39:52 2021 +0800
fix(hotkey): fix input and output of detect_hotkey in shell (#710)
---
rdsn | 2 +-
src/shell/commands/detect_hotkey.cpp | 33 +++++++++++++++++++++++++++------
src/shell/main.cpp | 2 +-
3 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/rdsn b/rdsn
index c8d9d80..f508428 160000
--- a/rdsn
+++ b/rdsn
@@ -1 +1 @@
-Subproject commit c8d9d80c2850d86e67bddbcaf5838492bec83a4b
+Subproject commit f5084283e91f73ae1bea50ad722ccd20561c76a7
diff --git a/src/shell/commands/detect_hotkey.cpp
b/src/shell/commands/detect_hotkey.cpp
index fd4bbe1..c1c2440 100644
--- a/src/shell/commands/detect_hotkey.cpp
+++ b/src/shell/commands/detect_hotkey.cpp
@@ -40,7 +40,7 @@ bool
generate_hotkey_request(dsn::replication::detect_hotkey_request &req,
req.action = dsn::replication::detect_action::START;
} else if (!strcasecmp(hotkey_action.c_str(), "stop")) {
req.action = dsn::replication::detect_action::STOP;
- } else if (!strcasecmp(hotkey_type.c_str(), "query")) {
+ } else if (!strcasecmp(hotkey_action.c_str(), "query")) {
req.action = dsn::replication::detect_action::QUERY;
} else {
err_info =
@@ -57,7 +57,7 @@ bool detect_hotkey(command_executor *e, shell_context *sc,
arguments args)
{
// detect_hotkey
// <-a|--app_id str><-p|--partition_index num><-t|--hotkey_type read|write>
- // <-c|--detect_action start|stop><-d|--address str>
+ // <-c|--detect_action start|stop|query><-d|--address str>
const std::set<std::string> params = {"a",
"app_id",
"p",
@@ -107,21 +107,42 @@ bool detect_hotkey(command_executor *e, shell_context
*sc, arguments args)
auto err = sc->ddl_client->detect_hotkey(dsn::rpc_address(target_address),
req, resp);
if (err != dsn::ERR_OK) {
fmt::print(stderr,
- "Hotkey detect rpc sending failed, in {}.{},
error_hint:{}\n",
+ "Hotkey detection rpc sending failed, in {}.{},
error_hint:{}\n",
app_id,
partition_index,
err.to_string());
- return false;
+ return true;
}
if (resp.err != dsn::ERR_OK) {
fmt::print(stderr,
- "Hotkey detect rpc performed failed, in {}.{},
error_hint:{} {}\n",
+ "Hotkey detection performed failed, in {}.{}, error_hint:{}
{}\n",
app_id,
partition_index,
resp.err,
resp.err_hint);
- return false;
+ return true;
+ }
+
+ switch (req.action) {
+ case dsn::replication::detect_action::START:
+ fmt::print("Hotkey detection is starting, using 'detect_hotkey -a {}
-p {} -t {} -c "
+ "query -d {}' to get the result later\n",
+ app_id,
+ partition_index,
+ hotkey_type,
+ ip_str);
+ break;
+ case dsn::replication::detect_action::STOP:
+ fmt::print("Hotkey detection is stopped now\n");
+ break;
+ case dsn::replication::detect_action::QUERY:
+ fmt::print("Find {} hotkey in {}.{} result:{}\n",
+ hotkey_type,
+ app_id,
+ partition_index,
+ resp.hotkey_result);
+ break;
}
return true;
diff --git a/src/shell/main.cpp b/src/shell/main.cpp
index 9a02ab3..43c2eb8 100644
--- a/src/shell/main.cpp
+++ b/src/shell/main.cpp
@@ -488,7 +488,7 @@ static command_executor commands[] = {
"<-a|--app_id num> "
"<-p|--partition_index num> "
"<-t|--hotkey_type read|write> "
- "<-c|--detect_action start|stop> "
+ "<-c|--detect_action start|stop|query> "
"<-d|--address str>",
detect_hotkey,
},
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]