levy5307 commented on a change in pull request #665:
URL: https://github.com/apache/incubator-pegasus/pull/665#discussion_r550445734



##########
File path: src/server/hotkey_collector.cpp
##########
@@ -239,23 +241,27 @@ void 
hotkey_collector::on_start_detect(dsn::replication::detect_hotkey_response
     switch (now_state) {
     case hotkey_collector_state::COARSE_DETECTING:
     case hotkey_collector_state::FINE_DETECTING:
-        resp.err = dsn::ERR_INVALID_STATE;
+        resp.err = dsn::ERR_BUSY;
         hint = fmt::format("still detecting {} hotkey, state is {}",
                            dsn::enum_to_string(_hotkey_type),
                            enum_to_string(now_state));
+        resp.__set_err_hint(hint);
         dwarn_replica(hint);
         return;
     case hotkey_collector_state::FINISHED:
-        resp.err = dsn::ERR_INVALID_STATE;
-        hint = fmt::format(
-            "{} hotkey result has been found, you can send a stop rpc to 
restart hotkey detection",
-            dsn::enum_to_string(_hotkey_type));
+        resp.err = dsn::ERR_BUSY;
+        hint = fmt::format("{} hotkey result has been found: {}, you can send 
a stop rpc to "
+                           "restart hotkey detection",
+                           dsn::enum_to_string(_hotkey_type),
+                           
pegasus::utils::c_escape_string(_result.hot_hash_key));
+        resp.__set_err_hint(hint);

Review comment:
       you can move these two lines out of switch:
   ```
           resp.__set_err_hint(hint);
           dwarn_replica(hint);
   ```




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to