You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pegasus.apache.org by GitBox <gi...@apache.org> on 2020/11/11 02:32:16 UTC

[GitHub] [incubator-pegasus] acelyc111 commented on a change in pull request #641: fix(hotspot): replace partition_resolver to ddl_client

acelyc111 commented on a change in pull request #641:
URL: https://github.com/apache/incubator-pegasus/pull/641#discussion_r521036548



##########
File path: src/server/hotspot_partition_calculator.cpp
##########
@@ -180,44 +177,39 @@ void hotspot_partition_calculator::detect_hotkey_in_hotpartition(int data_type)
     const dsn::replication::detect_action::type action)
 {
     FAIL_POINT_INJECT_F("send_detect_hotkey_request", [](dsn::string_view) {});
-    auto request = dsn::make_unique<dsn::replication::detect_hotkey_request>();
-    request->type = hotkey_type;
-    request->action = action;
+
+    dsn::replication::detect_hotkey_request req;
+    req.type = hotkey_type;
+    req.action = action;
+    dsn::replication::detect_hotkey_response resp;

Review comment:
       Move closer to the place where you use it, just before `_shell_context->ddl_client->detect_hotkey `

##########
File path: src/server/hotspot_partition_calculator.cpp
##########
@@ -180,44 +177,39 @@ void hotspot_partition_calculator::detect_hotkey_in_hotpartition(int data_type)
     const dsn::replication::detect_action::type action)
 {
     FAIL_POINT_INJECT_F("send_detect_hotkey_request", [](dsn::string_view) {});
-    auto request = dsn::make_unique<dsn::replication::detect_hotkey_request>();
-    request->type = hotkey_type;
-    request->action = action;
+
+    dsn::replication::detect_hotkey_request req;
+    req.type = hotkey_type;
+    req.action = action;
+    dsn::replication::detect_hotkey_response resp;
+
     ddebug_f("{} {} hotkey detection in {}.{}",
              (action == dsn::replication::detect_action::STOP) ? "Stop" : "Start",
              (hotkey_type == dsn::replication::hotkey_type::WRITE) ? "write" : "read",
              app_name,
              partition_index);
-    dsn::rpc_address meta_server;
-    meta_server.assign_group("meta-servers");
-    std::vector<dsn::rpc_address> meta_servers;
-    replica_helper::load_meta_servers(meta_servers);
-    for (const auto &address : meta_servers) {
-        meta_server.group_address()->add(address);
+
+    int app_id;
+    int partition_count;
+    std::vector<dsn::partition_configuration> partitions;
+    _shell_context->ddl_client->list_app(app_name, app_id, partition_count, partitions);
+    auto target_address = partitions[partition_index].primary;
+
+    auto error = _shell_context->ddl_client->detect_hotkey(target_address, req, resp);
+

Review comment:
       ```suggestion
   ```




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org