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 2022/02/14 02:41:58 UTC

[GitHub] [incubator-pegasus] levy5307 commented on a change in pull request #897: feat: add 'BATCH_GET' interface for read optimization

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



##########
File path: src/server/capacity_unit_calculator.cpp
##########
@@ -175,6 +179,27 @@ void capacity_unit_calculator::add_multi_get_cu(dsn::message_ex *req,
     _read_hotkey_collector->capture_hash_key(hash_key, key_count);
 }
 
+void capacity_unit_calculator::add_batch_get_cu(dsn::message_ex *req,
+                                                int32_t status,
+                                                const std::vector<::dsn::apps::full_data> &datas)
+{
+    int64_t data_size = 0;
+    for (const auto &data : datas) {
+        data_size += data.hash_key.size() + data.sort_key.size() + data.value.size();
+        _read_hotkey_collector->capture_hash_key(data.hash_key, 1);
+    }
+
+    _pfc_batch_get_bytes->add(data_size);
+    add_backup_request_bytes(req, data_size);
+
+    if (status != rocksdb::Status::kOk && status != rocksdb::Status::kNotFound &&
+        status != rocksdb::Status::kIncomplete && status != rocksdb::Status::kInvalidArgument) {
+        return;

Review comment:
       It's better to call `add_read_cu(1)` here.




-- 
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: dev-unsubscribe@pegasus.apache.org

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