This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.1 by this push:
new 1791cf269f9 branch-3.1: [fix](cloud) Sync storage resource once in
read path when rowset._storage_resource.fs is null #53075 (#53228)
1791cf269f9 is described below
commit 1791cf269f952dbf7e3f1a9833af7e974ae1b4b4
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Jul 15 15:34:35 2025 +0800
branch-3.1: [fix](cloud) Sync storage resource once in read path when
rowset._storage_resource.fs is null #53075 (#53228)
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]