Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
yiguolei committed Dec 27, 2024
1 parent 320ed9b commit e7a7fcf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 5 additions & 4 deletions be/src/runtime/exec_env_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,14 @@ ThreadPool* ExecEnv::non_block_close_thread_pool() {
#endif
}

ExecEnv::ExecEnv() = default;
ExecEnv::ExecEnv() {
// Doris Metrics is firstly initialized.
_doris_metrics = std::make_unique<DorisMetrics>();
}

ExecEnv::~ExecEnv() {
destroy();
_doris_metrics.reset();
}

Status ExecEnv::init(ExecEnv* env, const std::vector<StorePath>& store_paths,
Expand All @@ -204,8 +208,6 @@ Status ExecEnv::_init(const std::vector<StorePath>& store_paths,
if (ready()) {
return Status::OK();
}
// Doris Metrics is firstly initialized.
_doris_metrics = std::make_unique<DorisMetrics>();

std::unordered_map<std::string, std::unique_ptr<vectorized::SpillDataDir>> spill_store_map;
for (const auto& spill_path : spill_store_paths) {
Expand Down Expand Up @@ -845,7 +847,6 @@ void ExecEnv::destroy() {
SAFE_DELETE(_heap_profiler);

_s_tracking_memory = false;
_doris_metrics.reset();

LOG(INFO) << "Doris exec envorinment is destoried.";
}
Expand Down
6 changes: 4 additions & 2 deletions be/src/service/doris_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,10 @@ int main(int argc, char** argv) {
<< doris::config::spill_storage_root_path;
exit(-1);
}

// Should create exec env instance before others because many other modules depend on doris metrics in it.
auto* exec_env(doris::ExecEnv::GetInstance());

std::set<std::string> broken_paths;
doris::parse_conf_broken_store_paths(doris::config::broken_storage_path, &broken_paths);

Expand Down Expand Up @@ -525,8 +529,6 @@ int main(int argc, char** argv) {

doris::ThreadLocalHandle::create_thread_local_if_not_exits();

// init exec env
auto* exec_env(doris::ExecEnv::GetInstance());
status = doris::ExecEnv::init(doris::ExecEnv::GetInstance(), paths, spill_paths, broken_paths);
if (status != Status::OK()) {
std::cerr << "failed to init doris storage engine, res=" << status;
Expand Down

0 comments on commit e7a7fcf

Please sign in to comment.