2727#include < utility>
2828
2929#include " common/compiler_util.h" // IWYU pragma: keep
30+ #include " common/config.h"
3031#include " common/status.h"
3132#include " core/block/block.h"
3233#include " runtime/runtime_state.h"
@@ -57,7 +58,7 @@ std::shared_ptr<AdaptiveRandomBucketState> AdaptiveRandomBucketStatePool::get_or
5758 if (auto state = _pool[load_id].lock ()) {
5859 return state;
5960 }
60- auto state = std::make_shared<AdaptiveRandomBucketState>();
61+ auto state = std::make_shared<AdaptiveRandomBucketState>(load_id );
6162 _pool[load_id] = state;
6263 return state;
6364}
@@ -97,7 +98,8 @@ void AdaptiveRandomBucketState::init_partition(VOlapTablePartition* part) {
9798 }
9899 }
99100 _partition_states.emplace (part->id , std::move (state));
100- LOG (INFO) << " FIND_TABLET_RANDOM_BUCKET: partition=" << part->id
101+ LOG (INFO) << " FIND_TABLET_RANDOM_BUCKET: load_id=" << _load_id
102+ << " , partition=" << part->id
101103 << " shared start bucket=" << current_bucket
102104 << " , local_bucket_seqs=" << format_bucket_seqs (part->local_bucket_seqs );
103105}
@@ -112,6 +114,9 @@ int64_t AdaptiveRandomBucketState::current_bucket(int64_t partition_id) {
112114}
113115
114116void AdaptiveRandomBucketState::rotate_by_tablet (int64_t tablet_id) {
117+ if (!config::enable_adaptive_random_bucket_load_bucket_rotation) {
118+ return ;
119+ }
115120 std::lock_guard<std::mutex> lock (_mutex);
116121 auto partition_it = _tablet_to_partition.find (tablet_id);
117122 if (partition_it == _tablet_to_partition.end ()) {
@@ -132,7 +137,8 @@ void AdaptiveRandomBucketState::rotate_by_tablet(int64_t tablet_id) {
132137 }
133138 int32_t next_pos = (state.seq_pos + 1 ) % static_cast <int32_t >(state.local_bucket_seqs .size ());
134139 int32_t next_bucket = state.local_bucket_seqs [next_pos];
135- LOG (INFO) << " FIND_TABLET_RANDOM_BUCKET: partition=" << state.partition_id
140+ LOG (INFO) << " FIND_TABLET_RANDOM_BUCKET: load_id=" << _load_id
141+ << " , partition=" << state.partition_id
136142 << " shared rotate bucket " << current_bucket << " -> " << next_bucket
137143 << " after tablet=" << tablet_id << " memtable flushed" ;
138144 state.seq_pos = next_pos;
0 commit comments