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

dataroaring 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 021f80ce73d [improvement](group_comit) Add bvar to monitor the total 
wal count on disk (#31646)
021f80ce73d is described below

commit 021f80ce73d35dc5f95b4b674f7d824816908e27
Author: huanghaibin <[email protected]>
AuthorDate: Wed Mar 20 19:06:07 2024 +0800

    [improvement](group_comit) Add bvar to monitor the total wal count on disk 
(#31646)
---
 be/src/olap/wal/wal_manager.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/be/src/olap/wal/wal_manager.cpp b/be/src/olap/wal/wal_manager.cpp
index cce5d14d69e..0df70919078 100644
--- a/be/src/olap/wal/wal_manager.cpp
+++ b/be/src/olap/wal/wal_manager.cpp
@@ -17,6 +17,7 @@
 
 #include "olap/wal/wal_manager.h"
 
+#include <bvar/bvar.h>
 #include <glog/logging.h>
 
 #include <chrono>
@@ -38,6 +39,9 @@
 #include "vec/exec/format/wal/wal_reader.h"
 
 namespace doris {
+
+bvar::Status<size_t> g_wal_total_count("wal_total_count", 0);
+
 WalManager::WalManager(ExecEnv* exec_env, const std::string& wal_dir_list)
         : _exec_env(exec_env),
           _stop(false),
@@ -299,6 +303,7 @@ Status WalManager::_load_wals() {
 
 Status WalManager::_scan_wals(const std::string& wal_path, 
std::vector<ScanWalInfo>& res) {
     bool exists = false;
+    auto last_total_size = res.size();
     std::vector<io::FileInfo> dbs;
     Status st = io::global_local_filesystem()->list(wal_path, false, &dbs, 
&exists);
     if (!st.ok()) {
@@ -362,7 +367,8 @@ Status WalManager::_scan_wals(const std::string& wal_path, 
std::vector<ScanWalIn
             }
         }
     }
-    LOG(INFO) << "Finish list wal_dir=" << wal_path << ", wal count=" << 
res.size();
+    LOG(INFO) << "Finish list wal_dir=" << wal_path
+              << ", wal count=" << std::to_string(res.size() - 
last_total_size);
     return Status::OK();
 }
 
@@ -381,6 +387,7 @@ Status WalManager::_replay_background() {
         if (_first_replay.compare_exchange_strong(expected, false)) {
             RETURN_IF_ERROR(_load_wals());
         }
+        g_wal_total_count.set_value(get_wal_queue_size(-1));
         // replay wal of current process
         std::vector<int64_t> replay_tables;
         {


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

Reply via email to