Skip to content

Commit

Permalink
3
Browse files Browse the repository at this point in the history
  • Loading branch information
Yukang-Lian committed Jan 31, 2024
1 parent 167e37e commit 1715f58
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 4 deletions.
6 changes: 4 additions & 2 deletions be/src/http/action/http_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,10 @@ Status HttpStreamAction::_handle_group_commit(HttpRequest* req,
: req->header(HttpHeaders::CONTENT_LENGTH))
<< " Bytes) exceeds the WAL (Write-Ahead Log) limit ("
<< max_available_size << " Bytes). ";
return Status::Error<EXCEEDED_LIMIT>(
"There is no space for group commit async wal.");
std::stringstream ss;
ss << "There is no space for group commit async WAL. WAL dir info: "
<< ExecEnv::GetInstance()->wal_mgr()->get_wal_dirs_info_string();
return Status::Error<EXCEEDED_LIMIT>(ss.str());
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions be/src/http/action/stream_load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,10 @@ Status StreamLoadAction::_handle_group_commit(HttpRequest* req,
: req->header(HttpHeaders::CONTENT_LENGTH))
<< " Bytes) exceeds the WAL (Write-Ahead Log) limit ("
<< max_available_size << " Bytes). ";
return Status::Error<EXCEEDED_LIMIT>(
"There is no space for group commit async wal.");
std::stringstream ss;
ss << "There is no space for group commit async WAL. WAL dir info: "
<< ExecEnv::GetInstance()->wal_mgr()->get_wal_dirs_info_string();
return Status::Error<EXCEEDED_LIMIT>(ss.str());
}
}
}
Expand Down
16 changes: 16 additions & 0 deletions be/src/olap/wal/wal_dirs_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#include "olap/wal/wal_dirs_info.h"

#include <string>

#include "common/config.h"
#include "common/status.h"
#include "io/fs/local_file_system.h"
Expand Down Expand Up @@ -105,6 +107,12 @@ void WalDirInfo::update_wal_dir_pre_allocated(size_t increase_pre_allocated,
set_pre_allocated(increase_pre_allocated, decrease_pre_allocated);
}

std::string WalDirInfo::get_wal_dir_info_string() {
return "[" + _wal_dir + ": limit " + std::to_string(_limit) + " Bytes, used " +
std::to_string(_used) + " Bytes, pre allocated " + std::to_string(_pre_allocated) +
" Bytes, available " + std::to_string(available()) + "Bytes.]\n";
}

Status WalDirsInfo::add(const std::string& wal_dir, size_t limit, size_t used,
size_t pre_allocated) {
for (const auto& it : _wal_dirs_info_vec) {
Expand Down Expand Up @@ -155,6 +163,14 @@ size_t WalDirsInfo::get_max_available_size() {
->available();
}

std::string WalDirsInfo::get_wal_dirs_info_string() {
std::string wal_dirs_info_string;
for (const auto& wal_dir_info : _wal_dirs_info_vec) {
wal_dirs_info_string += wal_dir_info->get_wal_dir_info_string();
}
return wal_dirs_info_string;
}

Status WalDirsInfo::update_wal_dir_limit(const std::string& wal_dir, size_t limit) {
for (const auto& wal_dir_info : _wal_dirs_info_vec) {
LOG(INFO) << "wal_dir_info:" << wal_dir_info->get_wal_dir();
Expand Down
2 changes: 2 additions & 0 deletions be/src/olap/wal/wal_dirs_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class WalDirInfo {
Status update_wal_dir_limit(size_t limit = -1);
Status update_wal_dir_used(size_t used = -1);
void update_wal_dir_pre_allocated(size_t increase_pre_allocated, size_t decrease_pre_allocated);
std::string get_wal_dir_info_string();

private:
std::string _wal_dir;
Expand All @@ -75,6 +76,7 @@ class WalDirsInfo {
size_t decrease_pre_allocated);
Status get_wal_dir_available_size(const std::string& wal_dir, size_t* available_bytes);
Status get_wal_dir_info(const std::string& wal_dir, std::shared_ptr<WalDirInfo>& wal_dir_info);
std::string get_wal_dirs_info_string();

private:
std::vector<std::shared_ptr<WalDirInfo>> _wal_dirs_info_vec;
Expand Down
4 changes: 4 additions & 0 deletions be/src/olap/wal/wal_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,10 @@ size_t WalManager::get_max_available_size() {
return _wal_dirs_info->get_max_available_size();
}

std::string WalManager::get_wal_dirs_info_string() {
return _wal_dirs_info->get_wal_dirs_info_string();
}

Status WalManager::update_wal_dir_limit(const std::string& wal_dir, size_t limit) {
return _wal_dirs_info->update_wal_dir_limit(wal_dir, limit);
}
Expand Down
1 change: 1 addition & 0 deletions be/src/olap/wal/wal_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class WalManager {
size_t decrease_pre_allocated);
Status get_wal_dir_available_size(const std::string& wal_dir, size_t* available_bytes);
size_t get_max_available_size();
std::string get_wal_dirs_info_string();

// replay wal
Status create_wal_path(int64_t db_id, int64_t table_id, int64_t wal_id,
Expand Down

0 comments on commit 1715f58

Please sign in to comment.