This is an automated email from the ASF dual-hosted git repository.

laiyingchun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git


The following commit(s) were added to refs/heads/master by this push:
     new 2007d3ef fix(collector): fix unexpected crash in hotspot detection 
module (#984)
2007d3ef is described below

commit 2007d3efa92316f2aa735c49e4de22a4d8aa5f55
Author: Zhangqiu Yu <[email protected]>
AuthorDate: Sun May 29 23:31:24 2022 +0800

    fix(collector): fix unexpected crash in hotspot detection module (#984)
---
 src/server/hotspot_partition_calculator.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/server/hotspot_partition_calculator.cpp 
b/src/server/hotspot_partition_calculator.cpp
index 2c0a51ef..f072fc06 100644
--- a/src/server/hotspot_partition_calculator.cpp
+++ b/src/server/hotspot_partition_calculator.cpp
@@ -96,6 +96,8 @@ void hotspot_partition_calculator::init_perf_counter(int 
partition_count)
 void hotspot_partition_calculator::stat_histories_analyse(uint32_t data_type,
                                                           std::vector<int> 
&hot_points)
 {
+    int hot_point_size = _hot_points.size();
+    hot_points.assign(hot_point_size, 0);
     double table_qps_sum = 0, standard_deviation = 0, table_qps_avg = 0;
     int sample_count = 0;
     for (const auto &one_partition_stat_histories : 
_partitions_stat_histories) {
@@ -116,8 +118,6 @@ void 
hotspot_partition_calculator::stat_histories_analyse(uint32_t data_type,
     }
     standard_deviation = sqrt(standard_deviation / (sample_count - 1));
     const auto &anly_data = _partitions_stat_histories.back();
-    int hot_point_size = _hot_points.size();
-    hot_points.resize(hot_point_size);
     for (int i = 0; i < hot_point_size; i++) {
         double hot_point = 0;
         if (standard_deviation != 0) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to