Skip to content

Commit

Permalink
[Improvement](Storage) Lazy init mini_download dir (apache#24649)
Browse files Browse the repository at this point in the history
  • Loading branch information
sollhui authored Sep 22, 2023
1 parent 263506f commit c346f4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 6 additions & 7 deletions be/src/runtime/load_path_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ void LoadPathMgr::stop() {

Status LoadPathMgr::init() {
_path_vec.clear();
for (auto& path : _exec_env->store_paths()) {
_path_vec.push_back(path.path + "/" + MINI_PREFIX);
}
LOG(INFO) << "Load path configured to [" << boost::join(_path_vec, ",") << "]";

// error log is saved in first root path
Expand All @@ -91,13 +88,15 @@ Status LoadPathMgr::init() {

Status LoadPathMgr::allocate_dir(const std::string& db, const std::string& label,
std::string* prefix) {
if (_path_vec.empty()) {
return Status::InternalError("No load path configured.");
}
Status status = _init_once.call([this] {
for (auto& store_path : _exec_env->store_paths()) {
_path_vec.push_back(store_path.path + "/" + MINI_PREFIX);
}
return Status::OK();
});
std::string path;
auto size = _path_vec.size();
auto retry = size;
Status status = Status::OK();
while (retry--) {
{
// add SHARD_PREFIX for compatible purpose
Expand Down
2 changes: 2 additions & 0 deletions be/src/runtime/load_path_mgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "common/status.h"
#include "gutil/ref_counted.h"
#include "util/countdown_latch.h"
#include "util/once.h"

namespace doris {

Expand Down Expand Up @@ -70,6 +71,7 @@ class LoadPathMgr {
uint32_t _error_path_next_shard;
CountDownLatch _stop_background_threads_latch;
scoped_refptr<Thread> _clean_thread;
DorisCallOnce<Status> _init_once;
};

} // namespace doris

0 comments on commit c346f4d

Please sign in to comment.