This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new 59661fcb7d1 branch-4.0: [chore](log) return error to caller when
get_tablet in cloud mode #57520 (#57901)
59661fcb7d1 is described below
commit 59661fcb7d1ac45a86638bd442065be61d5ef10d
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Nov 12 09:14:58 2025 +0800
branch-4.0: [chore](log) return error to caller when get_tablet in cloud
mode #57520 (#57901)
Cherry-picked from #57520
Co-authored-by: Yixuan Wang <[email protected]>
---
be/src/cloud/cloud_tablet_mgr.cpp | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/be/src/cloud/cloud_tablet_mgr.cpp
b/be/src/cloud/cloud_tablet_mgr.cpp
index 28f4b60e1da..a3270e0dcf9 100644
--- a/be/src/cloud/cloud_tablet_mgr.cpp
+++ b/be/src/cloud/cloud_tablet_mgr.cpp
@@ -92,7 +92,8 @@ private:
std::unordered_map<Key, std::shared_ptr<Call>> _call_map;
};
-SingleFlight<int64_t /* tablet_id */, std::shared_ptr<CloudTablet>>
s_singleflight_load_tablet;
+// tablet_id -> load tablet function
+SingleFlight<int64_t, Result<std::shared_ptr<CloudTablet>>>
s_singleflight_load_tablet;
} // namespace
@@ -192,7 +193,7 @@ Result<std::shared_ptr<CloudTablet>>
CloudTabletMgr::get_tablet(int64_t tablet_i
++sync_stats->tablet_meta_cache_miss;
}
auto load_tablet = [this, &key, warmup_data, sync_delete_bitmap,
- sync_stats](int64_t tablet_id) ->
std::shared_ptr<CloudTablet> {
+ sync_stats](int64_t tablet_id) ->
Result<std::shared_ptr<CloudTablet>> {
TabletMetaSharedPtr tablet_meta;
auto start = std::chrono::steady_clock::now();
auto st = _engine.meta_mgr().get_tablet_meta(tablet_id,
&tablet_meta);
@@ -203,7 +204,7 @@ Result<std::shared_ptr<CloudTablet>>
CloudTabletMgr::get_tablet(int64_t tablet_i
}
if (!st.ok()) {
LOG(WARNING) << "failed to tablet " << tablet_id << ": " << st;
- return nullptr;
+ return ResultError(st);
}
auto tablet = std::make_shared<CloudTablet>(_engine,
std::move(tablet_meta));
@@ -215,7 +216,7 @@ Result<std::shared_ptr<CloudTablet>>
CloudTabletMgr::get_tablet(int64_t tablet_i
st = _engine.meta_mgr().sync_tablet_rowsets(tablet.get(), options,
sync_stats);
if (!st.ok()) {
LOG(WARNING) << "failed to sync tablet " << tablet_id << ": "
<< st;
- return nullptr;
+ return ResultError(st);
}
auto* handle = _cache->insert(key, value.release(), 1,
sizeof(CloudTablet),
@@ -229,10 +230,12 @@ Result<std::shared_ptr<CloudTablet>>
CloudTabletMgr::get_tablet(int64_t tablet_i
return ret;
};
- auto tablet = s_singleflight_load_tablet.load(tablet_id,
std::move(load_tablet));
- if (tablet == nullptr) {
- return ResultError(Status::InternalError("failed to get tablet
{}", tablet_id));
+ auto load_result = s_singleflight_load_tablet.load(tablet_id,
std::move(load_tablet));
+ if (!load_result.has_value()) {
+ return ResultError(Status::InternalError("failed to get tablet {},
msg={}", tablet_id,
+ load_result.error()));
}
+ auto tablet = load_result.value();
set_tablet_access_time_ms(tablet.get());
return tablet;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]