This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new b4768500f29 branch-3.0: [fix](asan) clear global storage resource map 
before exiting #54814 (#54826)
b4768500f29 is described below

commit b4768500f29a8b26cacc438afb44522e3e886b5d
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sun Aug 24 15:33:56 2025 +0800

    branch-3.0: [fix](asan) clear global storage resource map before exiting 
#54814 (#54826)
    
    Cherry-picked from #54814
    
    Co-authored-by: Yongqiang YANG <[email protected]>
---
 be/src/olap/storage_policy.cpp   | 5 +++++
 be/src/olap/storage_policy.h     | 2 ++
 be/src/runtime/exec_env_init.cpp | 2 ++
 3 files changed, 9 insertions(+)

diff --git a/be/src/olap/storage_policy.cpp b/be/src/olap/storage_policy.cpp
index 837e9bed178..b3c132b68e8 100644
--- a/be/src/olap/storage_policy.cpp
+++ b/be/src/olap/storage_policy.cpp
@@ -128,6 +128,11 @@ void delete_storage_resource(int64_t resource_id) {
     s_storage_resource_mgr.map.erase(id_str);
 }
 
+void clear_storage_resource() {
+    std::lock_guard lock(s_storage_resource_mgr.mtx);
+    s_storage_resource_mgr.map.clear();
+}
+
 std::vector<std::pair<std::string, int64_t>> get_storage_resource_ids() {
     std::vector<std::pair<std::string, int64_t>> res;
     res.reserve(s_storage_resource_mgr.map.size());
diff --git a/be/src/olap/storage_policy.h b/be/src/olap/storage_policy.h
index f79b1a05209..e83a447aa6a 100644
--- a/be/src/olap/storage_policy.h
+++ b/be/src/olap/storage_policy.h
@@ -104,6 +104,8 @@ void put_storage_resource(int64_t resource_id, 
StorageResource resource, int64_t
 
 void delete_storage_resource(int64_t resource_id);
 
+void clear_storage_resource();
+
 // return [id, version] of all resources
 std::vector<std::pair<std::string, int64_t>> get_storage_resource_ids();
 
diff --git a/be/src/runtime/exec_env_init.cpp b/be/src/runtime/exec_env_init.cpp
index 3ec7fed673f..d2f91c6664e 100644
--- a/be/src/runtime/exec_env_init.cpp
+++ b/be/src/runtime/exec_env_init.cpp
@@ -55,6 +55,7 @@
 #include "olap/schema_cache.h"
 #include "olap/segment_loader.h"
 #include "olap/storage_engine.h"
+#include "olap/storage_policy.h"
 #include "olap/tablet_column_object_pool.h"
 #include "olap/tablet_meta.h"
 #include "olap/tablet_schema_cache.h"
@@ -843,6 +844,7 @@ void ExecEnv::destroy() {
 
     _s_tracking_memory = false;
 
+    clear_storage_resource();
     LOG(INFO) << "Doris exec envorinment is destoried.";
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to