acelyc111 commented on a change in pull request #603: URL: https://github.com/apache/incubator-pegasus/pull/603#discussion_r499211145
########## File path: src/server/hotkey_collector.h ########## @@ -0,0 +1,73 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#pragma once + +#include <dsn/utility/string_view.h> +#include <dsn/dist/replication/replication_types.h> + +namespace pegasus { +namespace server { + +// hotkey_collector is responsible to find the hot keys after the partition Review comment: ```suggestion // hotkey_collector is responsible to find the hot keys after the partition ``` ########## File path: src/server/pegasus_server_impl.cpp ########## @@ -2798,5 +2800,28 @@ void pegasus_server_impl::set_ingestion_status(dsn::replication::ingestion_statu _ingestion_status = status; } +void pegasus_server_impl::on_detect_hotkey(const dsn::replication::detect_hotkey_request &req, + dsn::replication::detect_hotkey_response &resp) +{ + + if (req.action != dsn::replication::detect_action::START && Review comment: frequently read/write path, would better add DSN_UNLIKELY ########## File path: src/server/capacity_unit_calculator.cpp ########## @@ -97,6 +105,8 @@ void capacity_unit_calculator::add_get_cu(int32_t status, return; } + _read_hotkey_collector->capture_raw_key(key, key.size() + value.size()); + Review comment: I think it's not needed to add capture_raw_key in this PR, since only this is just a 'fundamental framework' PR, and some othe read/write paths like add_write_cu missing call it. ########## File path: src/server/pegasus_server_impl.cpp ########## @@ -2798,5 +2800,28 @@ void pegasus_server_impl::set_ingestion_status(dsn::replication::ingestion_statu _ingestion_status = status; } +void pegasus_server_impl::on_detect_hotkey(const dsn::replication::detect_hotkey_request &req, + dsn::replication::detect_hotkey_response &resp) +{ + + if (req.action != dsn::replication::detect_action::START && + req.action != dsn::replication::detect_action::STOP) { + resp.err = dsn::ERR_OBJECT_NOT_FOUND; + resp.__set_err_hint("invalid detect_action"); + return; + } + + if (req.type != dsn::replication::hotkey_type::READ && Review comment: same ---------------------------------------------------------------- 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]
