Skip to content

Commit d307084

Browse files
committed
save
1 parent f4b560e commit d307084

File tree

3 files changed

+93
-0
lines changed

3 files changed

+93
-0
lines changed

be/src/agent/utils.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ Status MasterServerClient::finish_task(const TFinishTaskRequest& request, TMaste
119119
}
120120

121121
Status MasterServerClient::report(const TReportRequest& request, TMasterResult* result) {
122+
#ifdef BE_TEST
123+
result->status.__set_status_code(TStatusCode::OK);
124+
return Status::OK();
125+
#else
122126
Status client_status;
123127
FrontendServiceConnection client(_client_cache.get(), _cluster_info->master_fe_addr,
124128
config::thrift_rpc_timeout_ms, &client_status);
@@ -173,6 +177,7 @@ Status MasterServerClient::report(const TReportRequest& request, TMasterResult*
173177
}
174178

175179
return Status::OK();
180+
#endif
176181
}
177182

178183
Status MasterServerClient::confirm_unused_remote_files(

be/test/agent/task_worker_pool_test.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,34 @@ TEST(TaskWorkerPoolTest, ReportWorkerPool) {
132132
EXPECT_EQ(count.load(), 3);
133133
}
134134

135+
TEST(TaskWorkerPoolTest, ReportTabletCallbackWithDebugPoint) {
136+
bool original_enable_debug_points = config::enable_debug_points;
137+
config::enable_debug_points = true;
138+
139+
ExecEnv::GetInstance()->set_storage_engine(std::make_unique<StorageEngine>(EngineOptions {}));
140+
141+
ClusterInfo cluster_info;
142+
cluster_info.master_fe_addr.__set_port(9030);
143+
144+
Defer defer {[] {
145+
ExecEnv::GetInstance()->set_storage_engine(nullptr);
146+
}};
147+
148+
{
149+
// debug point is enabled
150+
DebugPoints::instance()->add("WorkPoolReportTablet.report_tablet_callback.skip");
151+
EXPECT_TRUE(DebugPoints::instance()->is_enable("WorkPoolReportTablet.report_tablet_callback.skip"));
152+
report_tablet_callback(ExecEnv::GetInstance()->storage_engine().to_local(), &cluster_info);
153+
}
154+
155+
{
156+
// debug point is removed
157+
DebugPoints::instance()->remove("WorkPoolReportTablet.report_tablet_callback.skip");
158+
EXPECT_FALSE(DebugPoints::instance()->is_enable("WorkPoolReportTablet.report_tablet_callback.skip"));
159+
report_tablet_callback(ExecEnv::GetInstance()->storage_engine().to_local(), &cluster_info);
160+
}
161+
162+
config::enable_debug_points = original_enable_debug_points;
163+
}
164+
135165
} // namespace doris
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
#include "agent/task_worker_pool.h"
19+
20+
#include <gtest/gtest.h>
21+
22+
#include "olap/options.h"
23+
#include "cloud/cloud_storage_engine.h"
24+
#include "runtime/cluster_info.h"
25+
26+
namespace doris {
27+
28+
TEST(CloudTaskWorkerPoolTest, ReportTabletCallbackWithDebugPoint) {
29+
bool original_enable_debug_points = config::enable_debug_points;
30+
config::enable_debug_points = true;
31+
32+
ExecEnv::GetInstance()->set_storage_engine(std::make_unique<CloudStorageEngine>(EngineOptions {}));
33+
34+
ClusterInfo cluster_info;
35+
cluster_info.master_fe_addr.__set_port(9030);
36+
37+
Defer defer {[] {
38+
ExecEnv::GetInstance()->set_storage_engine(nullptr);
39+
}};
40+
41+
{
42+
// debug point is enabled
43+
DebugPoints::instance()->add("WorkPoolCloudReportTablet.report_tablet_callback.skip");
44+
EXPECT_TRUE(DebugPoints::instance()->is_enable("WorkPoolCloudReportTablet.report_tablet_callback.skip"));
45+
report_tablet_callback(ExecEnv::GetInstance()->storage_engine().to_cloud(), &cluster_info);
46+
}
47+
48+
{
49+
// debug point is removed
50+
DebugPoints::instance()->remove("WorkPoolCloudReportTablet.report_tablet_callback.skip");
51+
EXPECT_FALSE(DebugPoints::instance()->is_enable("WorkPoolCloudReportTablet.report_tablet_callback.skip"));
52+
report_tablet_callback(ExecEnv::GetInstance()->storage_engine().to_cloud(), &cluster_info);
53+
}
54+
55+
config::enable_debug_points = original_enable_debug_points;
56+
}
57+
58+
} // namespace doris

0 commit comments

Comments
 (0)