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/01 11:42:33 UTC

[GitHub] [incubator-doris] weizuo93 opened a new pull request #5592: [Refactor][Metrics] Update metrics of 'max_compaction_score'

weizuo93 opened a new pull request #5592:
URL: https://github.com/apache/incubator-doris/pull/5592


   ## Proposed changes
   
   Update metrics of `tablet_base_max_compaction_score` and `tablet_cumulative_max_compaction_score`. This two metrics should show `max compaction score` for base comapction and cumulative compaction after a round of task production in BE.
   
   ## Types of changes
   
   What types of changes does your code introduce to Doris?
   _Put an `x` in the boxes that apply_
   
   - [ ] Bugfix (non-breaking change which fixes an issue)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
   - [ ] Documentation Update (if none of the other choices apply)
   - [ x] Code refactor (Modify the code structure, format the code, etc...)
   
   ## Checklist
   
   _Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._
   
   - [ ] I have created an issue on (Fix #ISSUE) and described the bug/feature there in detail
   - [x ] Compiling and unit tests pass locally with my changes
   - [ ] I have added tests that prove my fix is effective or that my feature works
   - [ ] If these changes need document changes, I have updated the document
   - [x ] Any dependent changes have been merged
   


-- 
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


[GitHub] [incubator-doris] yangzhg commented on a change in pull request #5592: [Metrics][LOG] Update metrics of 'max_compaction_score' and log for compaction

Posted by GitBox <gi...@apache.org>.
yangzhg commented on a change in pull request #5592:
URL: https://github.com/apache/incubator-doris/pull/5592#discussion_r607437773



##########
File path: be/src/olap/tablet_manager.cpp
##########
@@ -681,7 +681,7 @@ void TabletManager::get_tablet_stat(TTabletStatResult* result) {
 
 TabletSharedPtr TabletManager::find_best_tablet_to_compaction(
         CompactionType compaction_type, DataDir* data_dir,
-        std::vector<TTabletId>& tablet_submitted_compaction) {
+        std::vector<TTabletId>& tablet_submitted_compaction, uint32_t& score) {

Review comment:
       use  a pointer instead




-- 
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


[GitHub] [incubator-doris] weizuo93 commented on a change in pull request #5592: [Metrics][LOG] Update metrics of 'max_compaction_score' and log for compaction

Posted by GitBox <gi...@apache.org>.
weizuo93 commented on a change in pull request #5592:
URL: https://github.com/apache/incubator-doris/pull/5592#discussion_r606230352



##########
File path: be/src/olap/olap_server.cpp
##########
@@ -386,20 +386,30 @@ void StorageEngine::_compaction_tasks_producer_callback() {
 std::vector<TabletSharedPtr> StorageEngine::_compaction_tasks_generator(
         CompactionType compaction_type, std::vector<DataDir*> data_dirs) {
     std::vector<TabletSharedPtr> tablets_compaction;
+    uint32_t max_compaction_score = 0;
     std::random_shuffle(data_dirs.begin(), data_dirs.end());
     for (auto data_dir : data_dirs) {
         std::unique_lock<std::mutex> lock(_tablet_submitted_compaction_mutex);
         if (_tablet_submitted_compaction[data_dir].size() >= config::compaction_task_num_per_disk) {
             continue;
         }
         if (!data_dir->reach_capacity_limit(0)) {
+            uint32_t disk_max_score = 0;
             TabletSharedPtr tablet = _tablet_manager->find_best_tablet_to_compaction(
-                    compaction_type, data_dir, _tablet_submitted_compaction[data_dir]);
+                    compaction_type, data_dir, _tablet_submitted_compaction[data_dir], disk_max_score);
             if (tablet != nullptr) {
                 tablets_compaction.emplace_back(tablet);
+                max_compaction_score = disk_max_score > max_compaction_score ? disk_max_score : max_compaction_score;

Review comment:
       OK.

##########
File path: be/src/olap/olap_server.cpp
##########
@@ -386,20 +386,30 @@ void StorageEngine::_compaction_tasks_producer_callback() {
 std::vector<TabletSharedPtr> StorageEngine::_compaction_tasks_generator(
         CompactionType compaction_type, std::vector<DataDir*> data_dirs) {
     std::vector<TabletSharedPtr> tablets_compaction;
+    uint32_t max_compaction_score = 0;
     std::random_shuffle(data_dirs.begin(), data_dirs.end());
     for (auto data_dir : data_dirs) {
         std::unique_lock<std::mutex> lock(_tablet_submitted_compaction_mutex);
         if (_tablet_submitted_compaction[data_dir].size() >= config::compaction_task_num_per_disk) {
             continue;
         }
         if (!data_dir->reach_capacity_limit(0)) {
+            uint32_t disk_max_score = 0;
             TabletSharedPtr tablet = _tablet_manager->find_best_tablet_to_compaction(
-                    compaction_type, data_dir, _tablet_submitted_compaction[data_dir]);
+                    compaction_type, data_dir, _tablet_submitted_compaction[data_dir], disk_max_score);
             if (tablet != nullptr) {
                 tablets_compaction.emplace_back(tablet);
+                max_compaction_score = disk_max_score > max_compaction_score ? disk_max_score : max_compaction_score;
             }
         }
     }
+    if (tablets_compaction.size() > 0) {

Review comment:
       OK.




-- 
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


[GitHub] [incubator-doris] weizuo93 commented on a change in pull request #5592: [Metrics][LOG] Update metrics of 'max_compaction_score' and log for compaction

Posted by GitBox <gi...@apache.org>.
weizuo93 commented on a change in pull request #5592:
URL: https://github.com/apache/incubator-doris/pull/5592#discussion_r606230272



##########
File path: be/src/olap/tablet_manager.h
##########
@@ -71,7 +71,7 @@ class TabletManager {
 
     TabletSharedPtr find_best_tablet_to_compaction(CompactionType compaction_type,
                                                    DataDir* data_dir,
-                                                   vector<TTabletId>& tablet_submitted_compaction);
+                                                   vector<TTabletId>& tablet_submitted_compaction, uint32_t& score);

Review comment:
       OK.




-- 
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


[GitHub] [incubator-doris] acelyc111 commented on a change in pull request #5592: [Metrics][LOG] Update metrics of 'max_compaction_score' and log for compaction

Posted by GitBox <gi...@apache.org>.
acelyc111 commented on a change in pull request #5592:
URL: https://github.com/apache/incubator-doris/pull/5592#discussion_r605681873



##########
File path: be/src/olap/olap_server.cpp
##########
@@ -386,20 +386,30 @@ void StorageEngine::_compaction_tasks_producer_callback() {
 std::vector<TabletSharedPtr> StorageEngine::_compaction_tasks_generator(
         CompactionType compaction_type, std::vector<DataDir*> data_dirs) {
     std::vector<TabletSharedPtr> tablets_compaction;
+    uint32_t max_compaction_score = 0;
     std::random_shuffle(data_dirs.begin(), data_dirs.end());
     for (auto data_dir : data_dirs) {
         std::unique_lock<std::mutex> lock(_tablet_submitted_compaction_mutex);
         if (_tablet_submitted_compaction[data_dir].size() >= config::compaction_task_num_per_disk) {
             continue;
         }
         if (!data_dir->reach_capacity_limit(0)) {
+            uint32_t disk_max_score = 0;
             TabletSharedPtr tablet = _tablet_manager->find_best_tablet_to_compaction(
-                    compaction_type, data_dir, _tablet_submitted_compaction[data_dir]);
+                    compaction_type, data_dir, _tablet_submitted_compaction[data_dir], disk_max_score);
             if (tablet != nullptr) {
                 tablets_compaction.emplace_back(tablet);
+                max_compaction_score = disk_max_score > max_compaction_score ? disk_max_score : max_compaction_score;

Review comment:
       ```suggestion
                   max_compaction_score = std::max(max_compaction_score, disk_max_score);
   ```

##########
File path: be/src/olap/olap_server.cpp
##########
@@ -386,20 +386,30 @@ void StorageEngine::_compaction_tasks_producer_callback() {
 std::vector<TabletSharedPtr> StorageEngine::_compaction_tasks_generator(
         CompactionType compaction_type, std::vector<DataDir*> data_dirs) {
     std::vector<TabletSharedPtr> tablets_compaction;
+    uint32_t max_compaction_score = 0;
     std::random_shuffle(data_dirs.begin(), data_dirs.end());
     for (auto data_dir : data_dirs) {
         std::unique_lock<std::mutex> lock(_tablet_submitted_compaction_mutex);
         if (_tablet_submitted_compaction[data_dir].size() >= config::compaction_task_num_per_disk) {
             continue;
         }
         if (!data_dir->reach_capacity_limit(0)) {
+            uint32_t disk_max_score = 0;
             TabletSharedPtr tablet = _tablet_manager->find_best_tablet_to_compaction(
-                    compaction_type, data_dir, _tablet_submitted_compaction[data_dir]);
+                    compaction_type, data_dir, _tablet_submitted_compaction[data_dir], disk_max_score);
             if (tablet != nullptr) {
                 tablets_compaction.emplace_back(tablet);
+                max_compaction_score = disk_max_score > max_compaction_score ? disk_max_score : max_compaction_score;
             }
         }
     }
+    if (tablets_compaction.size() > 0) {

Review comment:
       ```suggestion
       if (!tablets_compaction.empty()) {
   ```
   or `max_compaction_score > 0` ?

##########
File path: be/src/olap/tablet_manager.h
##########
@@ -71,7 +71,7 @@ class TabletManager {
 
     TabletSharedPtr find_best_tablet_to_compaction(CompactionType compaction_type,
                                                    DataDir* data_dir,
-                                                   vector<TTabletId>& tablet_submitted_compaction);
+                                                   vector<TTabletId>& tablet_submitted_compaction, uint32_t& score);

Review comment:
       ```suggestion
                                                      vector<TTabletId>& tablet_submitted_compaction,
                                                      uint32_t& score);
   ```




-- 
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


[GitHub] [incubator-doris] yangzhg merged pull request #5592: [Metrics][LOG] Update metrics of 'max_compaction_score' and log for compaction

Posted by GitBox <gi...@apache.org>.
yangzhg merged pull request #5592:
URL: https://github.com/apache/incubator-doris/pull/5592


   


-- 
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


[GitHub] [incubator-doris] weizuo93 commented on a change in pull request #5592: [Metrics][LOG] Update metrics of 'max_compaction_score' and log for compaction

Posted by GitBox <gi...@apache.org>.
weizuo93 commented on a change in pull request #5592:
URL: https://github.com/apache/incubator-doris/pull/5592#discussion_r607442443



##########
File path: be/src/olap/tablet_manager.cpp
##########
@@ -681,7 +681,7 @@ void TabletManager::get_tablet_stat(TTabletStatResult* result) {
 
 TabletSharedPtr TabletManager::find_best_tablet_to_compaction(
         CompactionType compaction_type, DataDir* data_dir,
-        std::vector<TTabletId>& tablet_submitted_compaction) {
+        std::vector<TTabletId>& tablet_submitted_compaction, uint32_t& score) {

Review comment:
       > use a pointer instead
   
   OK, Thank you.




-- 
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