Skip to content

Commit

Permalink
[improvement](group_comit) Add bvar to monitor the total wal count on…
Browse files Browse the repository at this point in the history
… disk (apache#31646)
  • Loading branch information
hust-hhb authored Mar 20, 2024
1 parent 4732997 commit 021f80c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion be/src/olap/wal/wal_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "olap/wal/wal_manager.h"

#include <bvar/bvar.h>
#include <glog/logging.h>

#include <chrono>
Expand All @@ -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),
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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();
}

Expand All @@ -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;
{
Expand Down

0 comments on commit 021f80c

Please sign in to comment.