liaoxin01 commented on code in PR #49962: URL: https://github.com/apache/doris/pull/49962#discussion_r2042123457
########## be/src/runtime/load_path_mgr.cpp: ########## @@ -96,8 +96,23 @@ Status LoadPathMgr::allocate_dir(const std::string& db, const std::string& label std::string path; auto size = _path_vec.size(); auto retry = size; + auto path_vec_num = 0; while (retry--) { { + size_t _disk_capacity_bytes = 0; + size_t _available_bytes = 0; Review Comment: ```suggestion size_t disk_capacity_bytes = 0; size_t available_bytes = 0; ``` ########## be/src/runtime/load_path_mgr.cpp: ########## @@ -110,7 +125,9 @@ Status LoadPathMgr::allocate_dir(const std::string& db, const std::string& label return Status::OK(); } } - + if (path_vec_num == size) { + return Status::BufferAllocFailed("Store path has less than 10% free space"); Review Comment: ```suggestion return Status::Error<DISK_REACH_CAPACITY_LIMIT, false>("exceed capacity limit."); ``` ########## be/src/http/action/stream_load.cpp: ########## @@ -153,6 +153,12 @@ void StreamLoadAction::handle(HttpRequest* req) { // update statistics streaming_load_requests_total->increment(1); streaming_load_duration_ms->increment(ctx->load_cost_millis); + LoadPathMgr* load_path_mgr = _exec_env->load_path_mgr(); Review Comment: ```suggestion if (!ctx->data_saved_path.empty()) { load_path_mgr->clean_tmp_files(ctx->data_saved_path); } ``` ########## be/src/runtime/load_path_mgr.cpp: ########## @@ -96,8 +96,23 @@ Status LoadPathMgr::allocate_dir(const std::string& db, const std::string& label std::string path; auto size = _path_vec.size(); auto retry = size; + auto path_vec_num = 0; while (retry--) { { + size_t _disk_capacity_bytes = 0; + size_t _available_bytes = 0; + + RETURN_IF_ERROR(io::global_local_filesystem()->get_space_info(_path_vec[_idx], &_disk_capacity_bytes, + &_available_bytes)); + int64_t remaining_bytes = _available_bytes - file_bytes; + double used_ratio = 1.0 - static_cast<double>(remaining_bytes) / _disk_capacity_bytes; + if (used_ratio >= config::storage_flood_stage_usage_percent / 100.0 && + remaining_bytes <= config::storage_flood_stage_left_capacity_bytes) { + LOG(WARNING) << "Store path " << _path_vec[_idx] + << " has less than 10% free space, skip it"; Review Comment: " exceed capacity limi. disk_capacity: " << disk_capacity_bytes << ", available: " << available_bytes << ", file_bytes" << file_bytes; ########## be/src/runtime/load_path_mgr.cpp: ########## @@ -178,6 +195,25 @@ void LoadPathMgr::process_path(time_t now, const std::string& path, int64_t rese } } +void LoadPathMgr::clean_files_in_path_vec(const std::string& path){ + bool exists = false; + // 检查路径是否存在 Review Comment: Please use English. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org