github-actions[bot] commented on code in PR #45411:
URL: https://github.com/apache/doris/pull/45411#discussion_r1883773164


##########
be/src/olap/tablet_manager.cpp:
##########
@@ -719,6 +719,11 @@ void TabletManager::get_tablet_stat(TTabletStatResult* 
result) {
     result->__set_tablet_stat_list(*local_cache);
 }
 
+struct TabletScore {
+    TabletSharedPtr tablet_ptr;
+    int score;
+};
+
 std::vector<TabletSharedPtr> TabletManager::find_best_tablets_to_compaction(

Review Comment:
   warning: function 'find_best_tablets_to_compaction' has cognitive complexity 
of 61 (threshold 50) [readability-function-cognitive-complexity]
   ```cpp
   std::vector<TabletSharedPtr> TabletManager::find_best_tablets_to_compaction(
                                               ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/olap/tablet_manager.cpp:733:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
               compaction_type == CompactionType::BASE_COMPACTION ? "base" : 
"cumulative";
                                                                  ^
   ```
   **be/src/olap/tablet_manager.cpp:739:** nesting level increased to 1
   ```cpp
       auto cmp = [](TabletScore left, TabletScore right) { return left.score > 
right.score; };
                  ^
   ```
   **be/src/olap/tablet_manager.cpp:742:** nesting level increased to 1
   ```cpp
       auto handler = [&](const TabletSharedPtr& tablet_ptr) {
                      ^
   ```
   **be/src/olap/tablet_manager.cpp:743:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           if 
(tablet_ptr->tablet_meta()->tablet_schema()->disable_auto_compaction()) {
           ^
   ```
   **be/src/olap/tablet_manager.cpp:750:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           if (config::enable_skip_tablet_compaction &&
           ^
   ```
   **be/src/olap/tablet_manager.cpp:754:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           if (!tablet_ptr->can_do_compaction(data_dir->path_hash(), 
compaction_type)) {
           ^
   ```
   **be/src/olap/tablet_manager.cpp:759:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           if (search != tablet_submitted_compaction.end()) {
           ^
   ```
   **be/src/olap/tablet_manager.cpp:764:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           if (compaction_type == CompactionType::BASE_COMPACTION) {
           ^
   ```
   **be/src/olap/tablet_manager.cpp:767:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           if (now_ms - last_failure_ms <= 5000) {
           ^
   ```
   **be/src/olap/tablet_manager.cpp:775:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           if (compaction_type == CompactionType::BASE_COMPACTION) {
           ^
   ```
   **be/src/olap/tablet_manager.cpp:778:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               if (!lock.owns_lock()) {
               ^
   ```
   **be/src/olap/tablet_manager.cpp:782:** +1, nesting level increased to 2
   ```cpp
           } else {
             ^
   ```
   **be/src/olap/tablet_manager.cpp:785:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               if (!lock.owns_lock()) {
               ^
   ```
   **be/src/olap/tablet_manager.cpp:793:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           if (current_compaction_score < 5) {
           ^
   ```
   **be/src/olap/tablet_manager.cpp:798:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           if (current_compaction_score > single_compact_highest_score &&
           ^
   ```
   **be/src/olap/tablet_manager.cpp:802:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               if (ret) {
               ^
   ```
   **be/src/olap/tablet_manager.cpp:808:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           if (config::compaction_num_per_round > 1 && 
!tablet_ptr->should_fetch_from_peer()) {
           ^
   ```
   **be/src/olap/tablet_manager.cpp:812:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               if ((top_tablets.size() >= config::compaction_num_per_round &&
               ^
   ```
   **be/src/olap/tablet_manager.cpp:817:** +4, including nesting penalty of 3, 
nesting level increased to 4
   ```cpp
                   if (ret) {
                   ^
   ```
   **be/src/olap/tablet_manager.cpp:819:** +5, including nesting penalty of 4, 
nesting level increased to 5
   ```cpp
                       if (top_tablets.size() > 
config::compaction_num_per_round) {
                       ^
   ```
   **be/src/olap/tablet_manager.cpp:822:** +5, including nesting penalty of 4, 
nesting level increased to 5
   ```cpp
                       if (current_compaction_score > highest_score) {
                       ^
   ```
   **be/src/olap/tablet_manager.cpp:827:** +1, nesting level increased to 2
   ```cpp
           } else {
             ^
   ```
   **be/src/olap/tablet_manager.cpp:828:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               if (current_compaction_score > highest_score && 
!tablet_ptr->should_fetch_from_peer()) {
               ^
   ```
   **be/src/olap/tablet_manager.cpp:831:** +4, including nesting penalty of 3, 
nesting level increased to 4
   ```cpp
                   if (ret) {
                   ^
   ```
   **be/src/olap/tablet_manager.cpp:841:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       if (best_tablet != nullptr) {
       ^
   ```
   **be/src/olap/tablet_manager.cpp:851:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       while (!top_tablets.empty()) {
       ^
   ```
   **be/src/olap/tablet_manager.cpp:861:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       if (best_single_compact_tablet != nullptr && 
single_compact_highest_score >= highest_score) {
       ^
   ```
   **be/src/olap/tablet_manager.cpp:861:** +1
   ```cpp
       if (best_single_compact_tablet != nullptr && 
single_compact_highest_score >= highest_score) {
                                                 ^
   ```
   **be/src/olap/tablet_manager.cpp:870:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       *score = highest_score > single_compact_highest_score ? highest_score
                                                             ^
   ```
   
   </details>
   



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

To unsubscribe, e-mail: [email protected]

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