You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2021/04/14 11:50:23 UTC

[GitHub] [incubator-doris] acelyc111 commented on a change in pull request #5651: [Compaction] Support to switching cumulative compaction policy dynamically

acelyc111 commented on a change in pull request #5651:
URL: https://github.com/apache/incubator-doris/pull/5651#discussion_r613169880



##########
File path: be/src/olap/tablet.cpp
##########
@@ -714,7 +718,7 @@ bool Tablet::can_do_compaction() {
     return true;
 }
 
-const uint32_t Tablet::calc_compaction_score(CompactionType compaction_type) const {
+const uint32_t Tablet::calc_compaction_score(CompactionType compaction_type) {

Review comment:
       ```suggestion
   uint32_t Tablet::calc_compaction_score(CompactionType compaction_type) {
   ```

##########
File path: be/src/common/configbase.cpp
##########
@@ -338,7 +340,11 @@ bool init(const char* conf_file, bool fill_conf_map, bool must_exist, bool set_t
         SET_FIELD(it.second, int32_t, fill_conf_map, set_to_default);
         SET_FIELD(it.second, int64_t, fill_conf_map, set_to_default);
         SET_FIELD(it.second, double, fill_conf_map, set_to_default);
-        SET_FIELD(it.second, std::string, fill_conf_map, set_to_default);
+        {
+            // add lock to ensure thread safe
+            std::lock_guard<std::mutex> lock(mutable_string_config_lock);
+            SET_FIELD(it.second, std::string, fill_conf_map, set_to_default);
+        }

Review comment:
       `init` is called in main when no other threads created, is it needed to use lock?

##########
File path: be/src/olap/olap_server.cpp
##########
@@ -205,29 +205,32 @@ void StorageEngine::_disk_stat_monitor_thread_callback() {
 }
 
 void StorageEngine::_check_cumulative_compaction_config() {
-    std::string cumulative_compaction_type = config::cumulative_compaction_policy;
+    std::string cumulative_compaction_type = "";

Review comment:
       Most of these configs are mutable, check them firstly here may be useless. A better way is to check them when any of them are mutated?

##########
File path: be/src/olap/tablet.h
##########
@@ -162,7 +162,7 @@ class Tablet : public BaseTablet {
 
     // operation for compaction
     bool can_do_compaction();
-    const uint32_t calc_compaction_score(CompactionType compaction_type) const;
+    const uint32_t calc_compaction_score(CompactionType compaction_type);

Review comment:
       ```suggestion
      uint32_t calc_compaction_score(CompactionType compaction_type);
   ```

##########
File path: be/src/olap/tablet.cpp
##########
@@ -88,6 +88,10 @@ OLAPStatus Tablet::_init_once_action() {
             << ", version_size=" << _tablet_meta->version_count();
 
     // init cumulative compaction policy by type
+    if (_cumulative_compaction_type == "") {

Review comment:
       Now _cumulative_compaction_policy will be created in _calc_cumulative_compaction_score, is it needed to create it here initially?




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org