[BugFix] Fix cache env init order (backport #62700) (#62712)

Signed-off-by: wyb <wybb86@gmail.com>
Co-authored-by: wyb <wybb86@gmail.com>
This commit is contained in:
mergify[bot] 2025-09-03 12:22:08 +00:00 committed by GitHub
parent 7640fb0302
commit 13755f4f16
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 4 deletions

View File

@ -107,16 +107,18 @@ void start_be(const std::vector<StorePath>& paths, bool as_cn) {
CHECK(global_vars->is_init()) << "global variables not initialized";
LOG(INFO) << process_name << " start step " << start_step++ << ": global variables init successfully";
auto* storage_engine = init_storage_engine(global_env, paths, as_cn);
LOG(INFO) << process_name << " start step " << start_step++ << ": storage engine init successfully";
// cache env should be initialized before init_storage_engine,
// because apply task is triggered in init_storage_engine and needs cache env.
auto* cache_env = DataCache::GetInstance();
EXIT_IF_ERROR(cache_env->init(paths));
LOG(INFO) << process_name << " start step " << start_step++ << ": cache env init successfully";
auto* storage_engine = init_storage_engine(global_env, paths, as_cn);
LOG(INFO) << process_name << " start step " << start_step++ << ": storage engine init successfully";
auto* exec_env = ExecEnv::GetInstance();
EXIT_IF_ERROR(exec_env->init(paths, as_cn));
LOG(INFO) << process_name << " start step " << start_step++ << ": exec engine init successfully";
LOG(INFO) << process_name << " start step " << start_step++ << ": exec env init successfully";
// Start all background threads of storage engine.
// SHOULD be called after exec env is initialized.