This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new 8e8aff039ba branch-3.0: [enhance](recycler)collect fdb metric when
recycler start #53656 (#54506)
8e8aff039ba is described below
commit 8e8aff039bae10d4e95f54e2cb13b4b7b74cab74
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Aug 12 10:52:08 2025 +0800
branch-3.0: [enhance](recycler)collect fdb metric when recycler start
#53656 (#54506)
Cherry-picked from #53656
Co-authored-by: koarz <[email protected]>
---
cloud/src/main.cpp | 12 ++++++++++++
cloud/src/meta-service/meta_server.cpp | 9 ---------
cloud/src/meta-service/meta_server.h | 1 -
cloud/test/meta_server_test.cpp | 10 ++--------
4 files changed, 14 insertions(+), 18 deletions(-)
diff --git a/cloud/src/main.cpp b/cloud/src/main.cpp
index 6d0c22f3204..aa057d6184e 100644
--- a/cloud/src/main.cpp
+++ b/cloud/src/main.cpp
@@ -27,6 +27,7 @@
#include <fstream>
#include <functional>
#include <iostream>
+#include <memory>
#include <mutex>
#include <sstream>
#include <thread>
@@ -274,6 +275,7 @@ int main(int argc, char** argv) {
std::unique_ptr<MetaServer> meta_server; // meta-service
std::unique_ptr<Recycler> recycler;
+ std::unique_ptr<FdbMetricExporter> fdb_metric_exporter;
std::thread periodiccally_log_thread;
std::mutex periodiccally_log_thread_lock;
std::condition_variable periodiccally_log_thread_cv;
@@ -315,6 +317,7 @@ int main(int argc, char** argv) {
periodiccally_log_thread = std::thread {periodiccally_log};
pthread_setname_np(periodiccally_log_thread.native_handle(),
"recycler_periodically_log");
}
+
// start service
brpc::ServerOptions options;
if (config::brpc_idle_timeout_sec != -1) {
@@ -331,6 +334,14 @@ int main(int argc, char** argv) {
return -1;
}
end = steady_clock::now();
+
+ fdb_metric_exporter = std::make_unique<FdbMetricExporter>(txn_kv);
+ ret = fdb_metric_exporter->start();
+ if (ret != 0) {
+ LOG(WARNING) << "failed to start fdb metric exporter";
+ return -2;
+ }
+
msg = "successfully started service listening on port=" +
std::to_string(port) +
" time_elapsed_ms=" + std::to_string(duration_cast<milliseconds>(end
- start).count());
LOG(INFO) << msg;
@@ -344,6 +355,7 @@ int main(int argc, char** argv) {
if (recycler) {
recycler->stop();
}
+ fdb_metric_exporter->stop();
if (periodiccally_log_thread.joinable()) {
{
diff --git a/cloud/src/meta-service/meta_server.cpp
b/cloud/src/meta-service/meta_server.cpp
index 9677d70b8c0..6606c41c708 100644
--- a/cloud/src/meta-service/meta_server.cpp
+++ b/cloud/src/meta-service/meta_server.cpp
@@ -63,14 +63,6 @@ int MetaServer::start(brpc::Server* server) {
return -1;
}
- fdb_metric_exporter_.reset(new FdbMetricExporter(txn_kv_));
- ret = fdb_metric_exporter_->start();
- TEST_SYNC_POINT_CALLBACK("MetaServer::start:3", &ret);
- if (ret != 0) {
- LOG(WARNING) << "failed to start fdb metric exporter";
- return -2;
- }
-
auto rate_limiter = std::make_shared<RateLimiter>();
// Add service
@@ -91,7 +83,6 @@ int MetaServer::start(brpc::Server* server) {
void MetaServer::stop() {
server_register_->stop();
- fdb_metric_exporter_->stop();
}
void MetaServerRegister::prepare_registry(ServiceRegistryPB* reg) {
diff --git a/cloud/src/meta-service/meta_server.h
b/cloud/src/meta-service/meta_server.h
index 556da773918..15d4985d097 100644
--- a/cloud/src/meta-service/meta_server.h
+++ b/cloud/src/meta-service/meta_server.h
@@ -48,7 +48,6 @@ public:
private:
std::shared_ptr<TxnKv> txn_kv_;
std::unique_ptr<MetaServerRegister> server_register_;
- std::unique_ptr<FdbMetricExporter> fdb_metric_exporter_;
};
class ServiceRegistryPB;
diff --git a/cloud/test/meta_server_test.cpp b/cloud/test/meta_server_test.cpp
index a6a44851f79..b59d39f2dac 100644
--- a/cloud/test/meta_server_test.cpp
+++ b/cloud/test/meta_server_test.cpp
@@ -168,10 +168,9 @@ TEST(MetaServerTest, StartAndStop) {
auto sp = SyncPoint::get_instance();
- std::array<std::string, 3> sps {"MetaServer::start:1",
"MetaServer::start:2",
- "MetaServer::start:3"};
+ std::array<std::string, 2> sps {"MetaServer::start:1",
"MetaServer::start:2"};
// use structured binding for point alias (avoid multi lines of
declaration)
- auto [meta_server_start_1, meta_server_start_2, meta_server_start_3] = sps;
+ auto [meta_server_start_1, meta_server_start_2] = sps;
sp->enable_processing();
DORIS_CLOUD_DEFER {
for (auto& i : sps) {
@@ -195,11 +194,6 @@ TEST(MetaServerTest, StartAndStop) {
ASSERT_EQ(server->start(&brpc_server), -1);
sp->clear_call_back(meta_server_start_2);
- // failed to start fdb metrics exporter
- sp->set_call_back(meta_server_start_3, foo);
- ASSERT_EQ(server->start(&brpc_server), -2);
- sp->clear_call_back(meta_server_start_3);
-
ASSERT_EQ(server->start(&brpc_server), 0);
ASSERT_EQ(brpc_server.Start(0, &options), 0);
auto addr = brpc_server.listen_address();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]