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 6b432f268e6 branch-3.0: [fix](cloud) Sync storage resource once in 
read path when rowset._storage_resource.fs is null #53075 (#53227)
6b432f268e6 is described below

commit 6b432f268e61a1e161c04eab387106a05618be7d
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Jul 15 10:20:20 2025 +0800

    branch-3.0: [fix](cloud) Sync storage resource once in read path when 
rowset._storage_resource.fs is null #53075 (#53227)
    
    Cherry-picked from #53075
    
    Co-authored-by: Lei Zhang <[email protected]>
---
 be/src/olap/rowset/rowset_meta.cpp | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/be/src/olap/rowset/rowset_meta.cpp 
b/be/src/olap/rowset/rowset_meta.cpp
index 137f5c745ce..0e6c76476b8 100644
--- a/be/src/olap/rowset/rowset_meta.cpp
+++ b/be/src/olap/rowset/rowset_meta.cpp
@@ -22,6 +22,7 @@
 #include <memory>
 #include <random>
 
+#include "cloud/cloud_storage_engine.h"
 #include "common/logging.h"
 #include "google/protobuf/util/message_differencer.h"
 #include "io/fs/file_writer.h"
@@ -112,16 +113,23 @@ Result<const StorageResource*> 
RowsetMeta::remote_storage_resource() {
     }
 
     if (!_storage_resource.fs) {
-        // not initialized yet
-        auto storage_resource = get_storage_resource(resource_id());
-        if (storage_resource) {
+        if (auto storage_resource = get_storage_resource(resource_id())) {
             _storage_resource = std::move(storage_resource->first);
         } else {
+            if (config::is_cloud_mode()) {
+                // When creating a new cluster or creating a storage resource, 
BE may not sync storage resource,
+                // at the moment a query is coming, the BetaRowsetReader call 
loadSegment and use this method
+                // to get the storage resource, so we need to sync storage 
resource here.
+                
ExecEnv::GetInstance()->storage_engine().to_cloud().sync_storage_vault();
+                if (auto retry_resource = get_storage_resource(resource_id())) 
{
+                    _storage_resource = std::move(retry_resource->first);
+                    return &_storage_resource;
+                }
+            }
             return ResultError(Status::InternalError("cannot find storage 
resource. resource_id={}",
                                                      resource_id()));
         }
     }
-
     return &_storage_resource;
 }
 


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

Reply via email to