github-actions[bot] commented on code in PR #43817: URL: https://github.com/apache/doris/pull/43817#discussion_r1839283177
########## be/src/runtime/cluster_info.h: ########## @@ -0,0 +1,48 @@ +// 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 <gen_cpp/Types_types.h> Review Comment: warning: 'gen_cpp/Types_types.h' file not found [clang-diagnostic-error] ```cpp #include <gen_cpp/Types_types.h> ^ ``` ########## be/src/agent/heartbeat_server.cpp: ########## @@ -291,8 +306,8 @@ Status HeartbeatServer::_heartbeat(const TMasterInfo& master_info) { Status create_heartbeat_server(ExecEnv* exec_env, uint32_t server_port, std::unique_ptr<ThriftServer>* thrift_server, - uint32_t worker_thread_num, TMasterInfo* local_master_info) { - HeartbeatServer* heartbeat_server = new HeartbeatServer(local_master_info); + uint32_t worker_thread_num, ClusterInfo* cluster_info) { + HeartbeatServer* heartbeat_server = new HeartbeatServer(cluster_info); Review Comment: warning: use auto when initializing with new to avoid duplicating the type name [modernize-use-auto] ```suggestion auto* heartbeat_server = new HeartbeatServer(cluster_info); ``` ########## cloud/src/meta-service/meta_service_helper.h: ########## @@ -19,7 +19,9 @@ #include <brpc/controller.h> Review Comment: warning: 'brpc/controller.h' file not found [clang-diagnostic-error] ```cpp #include <brpc/controller.h> ^ ``` ########## be/src/vec/columns/column_complex.h: ########## @@ -20,6 +20,8 @@ #pragma once +#include <glog/logging.h> Review Comment: warning: 'glog/logging.h' file not found [clang-diagnostic-error] ```cpp #include <glog/logging.h> ^ ``` ########## cloud/src/resource-manager/resource_manager.cpp: ########## @@ -199,6 +210,27 @@ return no_err; } +std::pair<bool, std::string> ResourceManager::get_instance_id_by_cloud_unique_id( + const std::string& cloud_unique_id) { + auto v = split(cloud_unique_id, ':'); + if (v.size() != 3) return {false, ""}; + // degraded format check it + int version = std::atoi(v[0].c_str()); + if (version != 1) return {false, ""}; Review Comment: warning: statement should be inside braces [readability-braces-around-statements] ```suggestion if (version != 1) { return {false, ""}; } ``` ########## cloud/src/resource-manager/resource_manager.cpp: ########## @@ -199,6 +210,27 @@ bool ResourceManager::check_cluster_params_valid(const ClusterPB& cluster, std:: return no_err; } +std::pair<bool, std::string> ResourceManager::get_instance_id_by_cloud_unique_id( + const std::string& cloud_unique_id) { + auto v = split(cloud_unique_id, ':'); + if (v.size() != 3) return {false, ""}; Review Comment: warning: statement should be inside braces [readability-braces-around-statements] ```suggestion if (v.size() != 3) { return {false, ""}; } ``` ########## cloud/test/meta_service_http_test.cpp: ########## @@ -1456,4 +1456,83 @@ TEST(MetaServiceHttpTest, TxnLazyCommit) { } } +TEST(MetaServiceHttpTest, get_stage_response_sk) { + auto sp = SyncPoint::get_instance(); + sp->enable_processing(); + std::unique_ptr<int, std::function<void(int*)>> defer((int*)0x01, + [&](...) { sp->disable_processing(); }); + + GetStageResponse res; Review Comment: warning: 'auto sp' can be declared as 'auto *sp' [readability-qualified-auto] ```suggestion e_sk) {auto * ``` ########## cloud/test/meta_service_http_test.cpp: ########## @@ -1456,4 +1456,83 @@ } } +TEST(MetaServiceHttpTest, get_stage_response_sk) { + auto sp = SyncPoint::get_instance(); + sp->enable_processing(); + std::unique_ptr<int, std::function<void(int*)>> defer((int*)0x01, + [&](...) { sp->disable_processing(); }); + + GetStageResponse res; + auto* stage = res.add_stage(); + stage->mutable_obj_info()->set_ak("stage-ak"); + stage->mutable_obj_info()->set_sk("stage-sk"); + auto foo = [res](auto args) { (*(try_any_cast<GetStageResponse**>(args[0])))->CopyFrom(res); }; + sp->set_call_back("stage_sk_response", foo); + sp->set_call_back("stage_sk_response_return", + [](auto&& args) { *try_any_cast<bool*>(args.back()) = true; }); + + auto rate_limiter = std::make_shared<cloud::RateLimiter>(); + + auto ms = std::make_unique<cloud::MetaServiceImpl>(nullptr, nullptr, rate_limiter); + + auto bar = [](auto args) { + std::cout << *try_any_cast<std::string*>(args[0]); + + EXPECT_TRUE((*try_any_cast<std::string*>(args[0])).find("stage-sk") == std::string::npos); + EXPECT_TRUE((*try_any_cast<std::string*>(args[0])) + .find("md5: f497d053066fa4b7d3b1f6564597d233") != std::string::npos); + }; + sp->set_call_back("sk_finish_rpc", bar); + + GetStageResponse res1; + GetStageRequest req1; + brpc::Controller cntl; + ms->get_stage(&cntl, &req1, &res1, nullptr); +} + +TEST(MetaServiceHttpTest, get_obj_store_info_response_sk) { + auto sp = SyncPoint::get_instance(); + sp->enable_processing(); + std::unique_ptr<int, std::function<void(int*)>> defer((int*)0x01, + [&](...) { sp->disable_processing(); }); + + GetObjStoreInfoResponse res; Review Comment: warning: 'auto sp' can be declared as 'auto *sp' [readability-qualified-auto] ```suggestion e_sk) {auto * ``` -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org