[Enhancement](Wal)Support dynamic wal space limit (#27726)

This commit is contained in:
abmdocrt
2023-12-27 11:51:32 +08:00
committed by GitHub
parent 8e358617c7
commit 9ff8bd2e9c
27 changed files with 846 additions and 227 deletions

View File

@ -22,6 +22,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <algorithm>
#include <memory>
#include <ostream>
#include <vector>
@ -38,6 +39,8 @@
#include "http/http_status.h"
#include "io/fs/file_system.h"
#include "io/fs/local_file_system.h"
#include "olap/wal_manager.h"
#include "runtime/exec_env.h"
#include "util/path_util.h"
#include "util/url_coding.h"
@ -199,8 +202,8 @@ bool load_size_smaller_than_wal_limit(HttpRequest* req) {
// these blocks within the limited space. So we need to set group_commit = false to avoid dead lock.
if (!req->header(HttpHeaders::CONTENT_LENGTH).empty()) {
size_t body_bytes = std::stol(req->header(HttpHeaders::CONTENT_LENGTH));
// TODO(Yukang): change it to WalManager::wal_limit
return (body_bytes <= config::wal_max_disk_size * 0.8) && (body_bytes != 0);
size_t max_available_size = ExecEnv::GetInstance()->wal_mgr()->get_max_available_size();
return (body_bytes != 0 && body_bytes < 0.8 * max_available_size);
} else {
return false;
}