github-actions[bot] commented on code in PR #45411:
URL: https://github.com/apache/doris/pull/45411#discussion_r1883746147
##########
be/src/olap/tablet_manager.cpp:
##########
@@ -736,6 +736,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:750:** +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:756:** nesting level increased to 1
```cpp
auto cmp = [](TabletScore left, TabletScore right) { return left.score >
right.score; };
^
```
**be/src/olap/tablet_manager.cpp:759:** nesting level increased to 1
```cpp
auto handler = [&](const TabletSharedPtr& tablet_ptr) {
^
```
**be/src/olap/tablet_manager.cpp:760:** +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:767:** +2, including nesting penalty of 1,
nesting level increased to 2
```cpp
if (config::enable_skip_tablet_compaction &&
^
```
**be/src/olap/tablet_manager.cpp:771:** +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:776:** +2, including nesting penalty of 1,
nesting level increased to 2
```cpp
if (search != tablet_submitted_compaction.end()) {
^
```
**be/src/olap/tablet_manager.cpp:781:** +2, including nesting penalty of 1,
nesting level increased to 2
```cpp
if (compaction_type == CompactionType::BASE_COMPACTION) {
^
```
**be/src/olap/tablet_manager.cpp:784:** +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:792:** +2, including nesting penalty of 1,
nesting level increased to 2
```cpp
if (compaction_type == CompactionType::BASE_COMPACTION) {
^
```
**be/src/olap/tablet_manager.cpp:795:** +3, including nesting penalty of 2,
nesting level increased to 3
```cpp
if (!lock.owns_lock()) {
^
```
**be/src/olap/tablet_manager.cpp:799:** +1, nesting level increased to 2
```cpp
} else {
^
```
**be/src/olap/tablet_manager.cpp:802:** +3, including nesting penalty of 2,
nesting level increased to 3
```cpp
if (!lock.owns_lock()) {
^
```
**be/src/olap/tablet_manager.cpp:810:** +2, including nesting penalty of 1,
nesting level increased to 2
```cpp
if (current_compaction_score < 5) {
^
```
**be/src/olap/tablet_manager.cpp:815:** +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:819:** +3, including nesting penalty of 2,
nesting level increased to 3
```cpp
if (ret) {
^
```
**be/src/olap/tablet_manager.cpp:825:** +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:829:** +3, including nesting penalty of 2,
nesting level increased to 3
```cpp
if ((top_tablets.size() >= config::compaction_num_per_round &&
current_compaction_score > top_tablets.top().score)
^
```
**be/src/olap/tablet_manager.cpp:833:** +4, including nesting penalty of 3,
nesting level increased to 4
```cpp
if (ret) {
^
```
**be/src/olap/tablet_manager.cpp:835:** +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:838:** +5, including nesting penalty of 4,
nesting level increased to 5
```cpp
if (current_compaction_score > highest_score) {
^
```
**be/src/olap/tablet_manager.cpp:843:** +1, nesting level increased to 2
```cpp
} else {
^
```
**be/src/olap/tablet_manager.cpp:844:** +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:847:** +4, including nesting penalty of 3,
nesting level increased to 4
```cpp
if (ret) {
^
```
**be/src/olap/tablet_manager.cpp:857:** +1, including nesting penalty of 0,
nesting level increased to 1
```cpp
if (best_tablet != nullptr) {
^
```
**be/src/olap/tablet_manager.cpp:867:** +1, including nesting penalty of 0,
nesting level increased to 1
```cpp
while (!top_tablets.empty()) {
^
```
**be/src/olap/tablet_manager.cpp:877:** +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:877:** +1
```cpp
if (best_single_compact_tablet != nullptr &&
single_compact_highest_score >= highest_score) {
^
```
**be/src/olap/tablet_manager.cpp:886:** +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]