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 966028cb37a branch-4.0: [Fix](TabletHotspot) Fix race in
`TabletHotspot::get_top_n_hot_partition` #60607 (#60625)
966028cb37a is described below
commit 966028cb37a56c56472d4755e7cd549d07a32c45
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Mar 4 18:40:58 2026 +0800
branch-4.0: [Fix](TabletHotspot) Fix race in
`TabletHotspot::get_top_n_hot_partition` #60607 (#60625)
Cherry-picked from #60607
Co-authored-by: bobhan1 <[email protected]>
Co-authored-by: yiguolei <[email protected]>
---
be/src/cloud/cloud_tablet_hotspot.cpp | 1 +
be/src/cloud/cloud_tablet_hotspot.h | 2 ++
2 files changed, 3 insertions(+)
diff --git a/be/src/cloud/cloud_tablet_hotspot.cpp
b/be/src/cloud/cloud_tablet_hotspot.cpp
index 6391a2dc5c4..71a6f4c92fd 100644
--- a/be/src/cloud/cloud_tablet_hotspot.cpp
+++ b/be/src/cloud/cloud_tablet_hotspot.cpp
@@ -146,6 +146,7 @@ void
TabletHotspot::get_top_n_hot_partition(std::vector<THotTableMessage>* hot_t
constexpr int N = 50;
int return_partitions = 0;
+ std::unique_lock lock(_last_partitions_mtx);
get_return_partitions(day_hot_partitions, _last_day_hot_partitions,
hot_tables,
return_partitions, N);
get_return_partitions(week_hot_partitions, _last_week_hot_partitions,
hot_tables,
diff --git a/be/src/cloud/cloud_tablet_hotspot.h
b/be/src/cloud/cloud_tablet_hotspot.h
index 0be1c085a6c..f5470295317 100644
--- a/be/src/cloud/cloud_tablet_hotspot.h
+++ b/be/src/cloud/cloud_tablet_hotspot.h
@@ -84,6 +84,8 @@ private:
bool _closed {false};
std::mutex _mtx;
std::condition_variable _cond;
+
+ std::mutex _last_partitions_mtx;
std::unordered_map<TabletHotspotMapKey, std::unordered_map<int64_t,
TabletHotspotMapValue>,
MapKeyHash>
_last_day_hot_partitions;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]