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 79be96b4afd branch-3.0: [fix](be) Fix `check_storage_vault` deadlock 
#52541 (#52602)
79be96b4afd is described below

commit 79be96b4afd2d8f919de4fb200d033b8ec3b9fda
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Jul 2 10:32:08 2025 +0800

    branch-3.0: [fix](be) Fix `check_storage_vault` deadlock #52541 (#52602)
    
    Cherry-picked from #52541
    
    Co-authored-by: Lei Zhang <[email protected]>
---
 be/src/cloud/cloud_storage_engine.cpp | 32 +++++++++++++++-----------------
 be/src/cloud/cloud_storage_engine.h   |  4 +++-
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/be/src/cloud/cloud_storage_engine.cpp 
b/be/src/cloud/cloud_storage_engine.cpp
index 1c07c4924a9..74a8f5068a4 100644
--- a/be/src/cloud/cloud_storage_engine.cpp
+++ b/be/src/cloud/cloud_storage_engine.cpp
@@ -190,7 +190,7 @@ struct RefreshFSVaultVisitor {
 };
 
 Status CloudStorageEngine::open() {
-    sync_storage_vault(config::enable_check_storage_vault);
+    sync_storage_vault();
 
     // TODO(plat1ko): DeleteBitmapTxnManager
 
@@ -335,25 +335,14 @@ Status CloudStorageEngine::start_bg_threads() {
     return Status::OK();
 }
 
-void CloudStorageEngine::sync_storage_vault(bool check_storage_vault) {
+void CloudStorageEngine::sync_storage_vault() {
     cloud::StorageVaultInfos vault_infos;
     bool enable_storage_vault = false;
-    auto st = Status::OK();
-    while (true) {
-        st = _meta_mgr->get_storage_vault_info(&vault_infos, 
&enable_storage_vault);
-        if (st.ok()) {
-            break;
-        }
-
-        if (!check_storage_vault) {
-            LOG(WARNING) << "failed to get storage vault info. err=" << st;
-            return;
-        }
 
-        LOG(WARNING) << "failed to get storage vault info from ms, err=" << st
-                     << " sleep 200ms retry or add 
enable_check_storage_vault=false to be.conf"
-                     << " to skip the check.";
-        std::this_thread::sleep_for(std::chrono::milliseconds(200));
+    auto st = _meta_mgr->get_storage_vault_info(&vault_infos, 
&enable_storage_vault);
+    if (!st.ok()) {
+        LOG(WARNING) << "failed to get storage vault info. err=" << st;
+        return;
     }
 
     if (vault_infos.empty()) {
@@ -361,6 +350,15 @@ void CloudStorageEngine::sync_storage_vault(bool 
check_storage_vault) {
         return;
     }
 
+    bool check_storage_vault = false;
+    bool expected = false;
+    if (first_sync_storage_vault.compare_exchange_strong(expected, true)) {
+        check_storage_vault = config::enable_check_storage_vault;
+        LOG(INFO) << "first sync storage vault info, BE try to check iam role 
connectivity, "
+                     "check_storage_vault="
+                  << check_storage_vault;
+    }
+
     for (auto& [id, vault_info, path_format] : vault_infos) {
         auto fs = get_filesystem(id);
         auto status =
diff --git a/be/src/cloud/cloud_storage_engine.h 
b/be/src/cloud/cloud_storage_engine.h
index 9e63be6c36c..f21e443a77e 100644
--- a/be/src/cloud/cloud_storage_engine.h
+++ b/be/src/cloud/cloud_storage_engine.h
@@ -137,7 +137,7 @@ public:
     std::shared_ptr<CloudCumulativeCompactionPolicy> cumu_compaction_policy(
             std::string_view compaction_policy);
 
-    void sync_storage_vault(bool check = false);
+    void sync_storage_vault();
 
     io::FileCacheBlockDownloader& file_cache_block_downloader() const {
         return *_file_cache_block_downloader;
@@ -219,6 +219,8 @@ private:
     using CumuPolices =
             std::unordered_map<std::string_view, 
std::shared_ptr<CloudCumulativeCompactionPolicy>>;
     CumuPolices _cumulative_compaction_policies;
+
+    std::atomic_bool first_sync_storage_vault {true};
 };
 
 } // namespace doris


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

Reply via email to