This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new ec5996f1f8 [improvement]do not acquire mutex in metric hook (#10941)
ec5996f1f8 is described below

commit ec5996f1f89542fbb9ed726a082e5ca6bd75d79c
Author: plat1ko <[email protected]>
AuthorDate: Mon Jul 18 08:52:24 2022 +0800

    [improvement]do not acquire mutex in metric hook (#10941)
---
 be/src/olap/storage_engine.cpp                             | 2 +-
 be/src/runtime/broker_mgr.cpp                              | 2 +-
 be/src/runtime/data_stream_mgr.cpp                         | 4 ++--
 be/src/runtime/external_scan_context_mgr.cpp               | 2 +-
 be/src/runtime/fragment_mgr.cpp                            | 2 +-
 be/src/runtime/load_channel_mgr.cpp                        | 2 +-
 be/src/runtime/result_buffer_mgr.cpp                       | 2 +-
 be/src/runtime/result_queue_mgr.cpp                        | 2 +-
 be/src/runtime/routine_load/routine_load_task_executor.cpp | 2 +-
 be/src/runtime/small_file_mgr.cpp                          | 2 +-
 be/src/runtime/stream_load/load_stream_mgr.cpp             | 2 +-
 11 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/be/src/olap/storage_engine.cpp b/be/src/olap/storage_engine.cpp
index c7d33a4187..43d6b02ca5 100644
--- a/be/src/olap/storage_engine.cpp
+++ b/be/src/olap/storage_engine.cpp
@@ -136,7 +136,7 @@ StorageEngine::StorageEngine(const EngineOptions& options)
           _stream_load_recorder(nullptr) {
     _s_instance = this;
     REGISTER_HOOK_METRIC(unused_rowsets_count, [this]() {
-        std::lock_guard<std::mutex> lock(_gc_mutex);
+        // std::lock_guard<std::mutex> lock(_gc_mutex);
         return _unused_rowsets.size();
     });
     REGISTER_HOOK_METRIC(compaction_mem_consumption,
diff --git a/be/src/runtime/broker_mgr.cpp b/be/src/runtime/broker_mgr.cpp
index f0c80d4cad..73300a9667 100644
--- a/be/src/runtime/broker_mgr.cpp
+++ b/be/src/runtime/broker_mgr.cpp
@@ -38,7 +38,7 @@ BrokerMgr::BrokerMgr(ExecEnv* exec_env) : 
_exec_env(exec_env), _stop_background_
                   .ok());
 
     REGISTER_HOOK_METRIC(broker_count, [this]() {
-        std::lock_guard<std::mutex> l(_mutex);
+        // std::lock_guard<std::mutex> l(_mutex);
         return _broker_set.size();
     });
 }
diff --git a/be/src/runtime/data_stream_mgr.cpp 
b/be/src/runtime/data_stream_mgr.cpp
index ca09a8700d..b0d1dbd8f2 100644
--- a/be/src/runtime/data_stream_mgr.cpp
+++ b/be/src/runtime/data_stream_mgr.cpp
@@ -44,11 +44,11 @@ using std::lock_guard;
 
 DataStreamMgr::DataStreamMgr() {
     REGISTER_HOOK_METRIC(data_stream_receiver_count, [this]() {
-        lock_guard<mutex> l(_lock);
+        // lock_guard<mutex> l(_lock);
         return _receiver_map.size();
     });
     REGISTER_HOOK_METRIC(fragment_endpoint_count, [this]() {
-        lock_guard<mutex> l(_lock);
+        // lock_guard<mutex> l(_lock);
         return _fragment_stream_set.size();
     });
 }
diff --git a/be/src/runtime/external_scan_context_mgr.cpp 
b/be/src/runtime/external_scan_context_mgr.cpp
index f662c1b04c..8fa2183eba 100644
--- a/be/src/runtime/external_scan_context_mgr.cpp
+++ b/be/src/runtime/external_scan_context_mgr.cpp
@@ -39,7 +39,7 @@ ExternalScanContextMgr::ExternalScanContextMgr(ExecEnv* 
exec_env)
                   .ok());
 
     REGISTER_HOOK_METRIC(active_scan_context_count, [this]() {
-        std::lock_guard<std::mutex> l(_lock);
+        // std::lock_guard<std::mutex> l(_lock);
         return _active_contexts.size();
     });
 }
diff --git a/be/src/runtime/fragment_mgr.cpp b/be/src/runtime/fragment_mgr.cpp
index 7d1cd44002..9e1918d5f1 100644
--- a/be/src/runtime/fragment_mgr.cpp
+++ b/be/src/runtime/fragment_mgr.cpp
@@ -435,7 +435,7 @@ FragmentMgr::FragmentMgr(ExecEnv* exec_env)
     _entity = 
DorisMetrics::instance()->metric_registry()->register_entity("FragmentMgr");
     INT_UGAUGE_METRIC_REGISTER(_entity, timeout_canceled_fragment_count);
     REGISTER_HOOK_METRIC(plan_fragment_count, [this]() {
-        std::lock_guard<std::mutex> lock(_lock);
+        // std::lock_guard<std::mutex> lock(_lock);
         return _fragment_map.size();
     });
 
diff --git a/be/src/runtime/load_channel_mgr.cpp 
b/be/src/runtime/load_channel_mgr.cpp
index c105bd96b3..fa30fca822 100644
--- a/be/src/runtime/load_channel_mgr.cpp
+++ b/be/src/runtime/load_channel_mgr.cpp
@@ -67,7 +67,7 @@ static int64_t calc_channel_timeout_s(int64_t 
timeout_in_req_s) {
 
 LoadChannelMgr::LoadChannelMgr() : _stop_background_threads_latch(1) {
     REGISTER_HOOK_METRIC(load_channel_count, [this]() {
-        std::lock_guard<std::mutex> l(_lock);
+        // std::lock_guard<std::mutex> l(_lock);
         return _load_channels.size();
     });
 }
diff --git a/be/src/runtime/result_buffer_mgr.cpp 
b/be/src/runtime/result_buffer_mgr.cpp
index d51ae4a679..ce589dd745 100644
--- a/be/src/runtime/result_buffer_mgr.cpp
+++ b/be/src/runtime/result_buffer_mgr.cpp
@@ -37,7 +37,7 @@ ResultBufferMgr::ResultBufferMgr() : 
_stop_background_threads_latch(1) {
     // Each BufferControlBlock has a limited queue size of 1024, it's not 
needed to count the
     // actual size of all BufferControlBlock.
     REGISTER_HOOK_METRIC(result_buffer_block_count, [this]() {
-        std::lock_guard<std::mutex> l(_lock);
+        // std::lock_guard<std::mutex> l(_lock);
         return _buffer_map.size();
     });
 }
diff --git a/be/src/runtime/result_queue_mgr.cpp 
b/be/src/runtime/result_queue_mgr.cpp
index 5dbae4787e..4f30f91345 100644
--- a/be/src/runtime/result_queue_mgr.cpp
+++ b/be/src/runtime/result_queue_mgr.cpp
@@ -31,7 +31,7 @@ ResultQueueMgr::ResultQueueMgr() {
     // Each BlockingQueue has a limited size (default 20, by 
config::max_memory_sink_batch_count),
     // it's not needed to count the actual size of all BlockingQueue.
     REGISTER_HOOK_METRIC(result_block_queue_count, [this]() {
-        std::lock_guard<std::mutex> l(_lock);
+        // std::lock_guard<std::mutex> l(_lock);
         return _fragment_queue_map.size();
     });
 }
diff --git a/be/src/runtime/routine_load/routine_load_task_executor.cpp 
b/be/src/runtime/routine_load/routine_load_task_executor.cpp
index 66a75a8c4e..804af26215 100644
--- a/be/src/runtime/routine_load/routine_load_task_executor.cpp
+++ b/be/src/runtime/routine_load/routine_load_task_executor.cpp
@@ -40,7 +40,7 @@ RoutineLoadTaskExecutor::RoutineLoadTaskExecutor(ExecEnv* 
exec_env)
                        config::routine_load_thread_pool_size),
           _data_consumer_pool(config::routine_load_consumer_pool_size) {
     REGISTER_HOOK_METRIC(routine_load_task_count, [this]() {
-        std::lock_guard<std::mutex> l(_lock);
+        // std::lock_guard<std::mutex> l(_lock);
         return _task_map.size();
     });
 
diff --git a/be/src/runtime/small_file_mgr.cpp 
b/be/src/runtime/small_file_mgr.cpp
index 504d25a889..3e542bb551 100644
--- a/be/src/runtime/small_file_mgr.cpp
+++ b/be/src/runtime/small_file_mgr.cpp
@@ -40,7 +40,7 @@ DEFINE_GAUGE_METRIC_PROTOTYPE_2ARG(small_file_cache_count, 
MetricUnit::NOUNIT);
 SmallFileMgr::SmallFileMgr(ExecEnv* env, const std::string& local_path)
         : _exec_env(env), _local_path(local_path) {
     REGISTER_HOOK_METRIC(small_file_cache_count, [this]() {
-        std::lock_guard<std::mutex> l(_lock);
+        // std::lock_guard<std::mutex> l(_lock);
         return _file_cache.size();
     });
 }
diff --git a/be/src/runtime/stream_load/load_stream_mgr.cpp 
b/be/src/runtime/stream_load/load_stream_mgr.cpp
index 38a4441743..c486dccd8d 100644
--- a/be/src/runtime/stream_load/load_stream_mgr.cpp
+++ b/be/src/runtime/stream_load/load_stream_mgr.cpp
@@ -25,7 +25,7 @@ LoadStreamMgr::LoadStreamMgr() {
     // Each StreamLoadPipe has a limited buffer size (default 1M), it's not 
needed to count the
     // actual size of all StreamLoadPipe.
     REGISTER_HOOK_METRIC(stream_load_pipe_count, [this]() {
-        std::lock_guard<std::mutex> l(_lock);
+        // std::lock_guard<std::mutex> l(_lock);
         return _stream_map.size();
     });
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to