diff --git a/rdsn b/rdsn index 91f9f4e4dc..a975bd65bd 160000 --- a/rdsn +++ b/rdsn @@ -1 +1 @@ -Subproject commit 91f9f4e4dc15f80de628820acf994f74a295ffee +Subproject commit a975bd65bd8f0b10f38d235b1088d0aa9e31bddd diff --git a/src/server/hotkey_collector.cpp b/src/server/hotkey_collector.cpp index 4ba9c7b2a3..16c69a63b2 100644 --- a/src/server/hotkey_collector.cpp +++ b/src/server/hotkey_collector.cpp @@ -171,10 +171,10 @@ detect_hotkey_result hotkey_coarse_data_collector::internal_analysis_method(const std::vector &captured_keys, int threshold) { - int data_size = captured_keys.size(); - dassert(captured_keys.size() > 2, "data_capture_hash_bucket_num is too small"); - + dcheck_gt(captured_keys.size(), 2); + // empirical rule to calculate hot point of each partition + // same algorithm as hotspot_partition_calculator::stat_histories_analyse double table_captured_key_sum = 0; int hot_index = 0; int hot_value = 0; @@ -197,8 +197,9 @@ hotkey_coarse_data_collector::internal_analysis_method(const std::vector threshold ? result.coarse_bucket_index = hot_index - : result.coarse_bucket_index = -1; + if (hot_point > threshold) { + result.coarse_bucket_index = hot_index; + } return result; } diff --git a/src/server/hotkey_collector.h b/src/server/hotkey_collector.h index 6e903acfd0..532e7207c7 100644 --- a/src/server/hotkey_collector.h +++ b/src/server/hotkey_collector.h @@ -28,8 +28,7 @@ class internal_collector_base; struct detect_hotkey_result { - int coarse_bucket_index; - detect_hotkey_result() : coarse_bucket_index(-1) {} + int coarse_bucket_index = -1; }; // hotkey_collector is responsible to find the hot keys after the partition @@ -105,7 +104,7 @@ class internal_collector_base : public dsn::replication::replica_base class hotkey_empty_data_collector : public internal_collector_base { public: - explicit hotkey_empty_data_collector(replica_base *base) : internal_collector_base(base){}; + explicit hotkey_empty_data_collector(replica_base *base) : internal_collector_base(base) {} void capture_data(const dsn::blob &hash_key, uint64_t weight) override {} void analyse_data(detect_hotkey_result &result) override {} };