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 24c1953e91 [fix](debug) add bvar counter for memtable & loadchannel 
(#22578)
24c1953e91 is described below

commit 24c1953e91f36c0e9d74d22e43b6a7a68342bef3
Author: zhengyu <freeman.zhang1...@gmail.com>
AuthorDate: Fri Aug 4 13:58:28 2023 +0800

    [fix](debug) add bvar counter for memtable & loadchannel (#22578)
    
    * [fix](debug) add bvar counter for memtable & loadchannel
    
    Signed-off-by: freemandealer <freeman.zhang1...@gmail.com>
    
    * format code
    
    Signed-off-by: freemandealer <freeman.zhang1...@gmail.com>
    
    ---------
    
    Signed-off-by: freemandealer <freeman.zhang1...@gmail.com>
---
 be/src/olap/memtable.cpp        | 6 ++++++
 be/src/runtime/load_channel.cpp | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/be/src/olap/memtable.cpp b/be/src/olap/memtable.cpp
index 95854c640d..fbcec31138 100644
--- a/be/src/olap/memtable.cpp
+++ b/be/src/olap/memtable.cpp
@@ -26,6 +26,7 @@
 #include <string>
 #include <vector>
 
+#include "bvar/bvar.h"
 #include "common/config.h"
 #include "olap/memtable_memory_limiter.h"
 #include "olap/olap_define.h"
@@ -41,6 +42,9 @@
 #include "vec/columns/column.h"
 
 namespace doris {
+
+bvar::Adder<int64_t> g_memtable_cnt("memtable_cnt");
+
 using namespace ErrorCode;
 
 MemTable::MemTable(int64_t tablet_id, const TabletSchema* tablet_schema,
@@ -59,6 +63,7 @@ MemTable::MemTable(int64_t tablet_id, const TabletSchema* 
tablet_schema,
           _offsets_of_aggregate_states(tablet_schema->num_columns()),
           _total_size_of_aggregate_states(0),
           _mem_usage(0) {
+    g_memtable_cnt << 1;
 #ifndef BE_TEST
     _insert_mem_tracker_use_hook = std::make_unique<MemTracker>(
             fmt::format("MemTableHookInsert:TabletId={}", 
std::to_string(tablet_id)),
@@ -129,6 +134,7 @@ void MemTable::_init_agg_functions(const vectorized::Block* 
block) {
 }
 
 MemTable::~MemTable() {
+    g_memtable_cnt << -1;
     if (_keys_type != KeysType::DUP_KEYS) {
         for (auto it = _row_in_blocks.begin(); it != _row_in_blocks.end(); 
it++) {
             if (!(*it)->has_init_agg()) {
diff --git a/be/src/runtime/load_channel.cpp b/be/src/runtime/load_channel.cpp
index 90432a386d..24da20acc3 100644
--- a/be/src/runtime/load_channel.cpp
+++ b/be/src/runtime/load_channel.cpp
@@ -20,11 +20,14 @@
 #include <gen_cpp/internal_service.pb.h>
 #include <glog/logging.h>
 
+#include "bvar/bvar.h"
 #include "runtime/memory/mem_tracker.h"
 #include "runtime/tablets_channel.h"
 
 namespace doris {
 
+bvar::Adder<int64_t> g_loadchannel_cnt("loadchannel_cnt");
+
 LoadChannel::LoadChannel(const UniqueId& load_id, int64_t timeout_s, bool 
is_high_priority,
                          const std::string& sender_ip, int64_t backend_id, 
bool enable_profile)
         : _load_id(load_id),
@@ -33,6 +36,7 @@ LoadChannel::LoadChannel(const UniqueId& load_id, int64_t 
timeout_s, bool is_hig
           _sender_ip(sender_ip),
           _backend_id(backend_id),
           _enable_profile(enable_profile) {
+    g_loadchannel_cnt << 1;
     // _last_updated_time should be set before being inserted to
     // _load_channels in load_channel_mgr, or it may be erased
     // immediately by gc thread.
@@ -41,6 +45,7 @@ LoadChannel::LoadChannel(const UniqueId& load_id, int64_t 
timeout_s, bool is_hig
 }
 
 LoadChannel::~LoadChannel() {
+    g_loadchannel_cnt << -1;
     LOG(INFO) << "load channel removed"
               << " load_id=" << _load_id << ", is high priority=" << 
_is_high_priority
               << ", sender_ip=" << _sender_ip;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to