Smityz commented on a change in pull request #592:
URL: https://github.com/apache/incubator-pegasus/pull/592#discussion_r487811540



##########
File path: src/server/hotspot_partition_calculator.cpp
##########
@@ -34,67 +35,84 @@ DSN_DEFINE_int64("pegasus.collector",
                  "eliminate outdated historical "
                  "data");
 
-void hotspot_partition_calculator::data_aggregate(const std::vector<row_data> 
&partitions)
+void hotspot_partition_calculator::data_aggregate(const std::vector<row_data> 
&partition_stats)
 {
-    while (_partition_stat_histories.size() > FLAGS_max_hotspot_store_size - 
1) {
-        _partition_stat_histories.pop();
+    while (_partitions_stat_histories.size() >= FLAGS_max_hotspot_store_size) {
+        _partitions_stat_histories.pop_front();
     }
-    std::vector<hotspot_partition_data> temp(partitions.size());
-    // TODO refactor the data structure
-    for (int i = 0; i < partitions.size(); i++) {
-        temp[i] = std::move(hotspot_partition_data(partitions[i]));
+    std::vector<hotspot_partition_stat> temp;
+    for (const auto &partition_stat : partition_stats) {
+        temp.emplace_back(hotspot_partition_stat(partition_stat));

Review comment:
       Yes, it's guaranteeed by its 
constructor(https://github.com/apache/incubator-pegasus/blob/master/src/server/info_collector.cpp#L296-L307)

##########
File path: src/server/hotspot_partition_calculator.h
##########
@@ -40,14 +47,14 @@ class hotspot_partition_calculator
 
 private:
     const std::string _app_name;
-
     void init_perf_counter(int perf_counter_count);
     // usually a partition with "hot-point value" >= 3 can be considered as a 
hotspot partition.

Review comment:
       "hot-point value" is a value of partition to show whether it is hot. It 
is an int type usually ranges from 0  to 10, if one partition's value >=3, it 
can be considered as a hotspot partition.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to