github-actions[bot] commented on code in PR #40115:
URL: https://github.com/apache/doris/pull/40115#discussion_r1735838588
##########
be/src/olap/schema_change.cpp:
##########
@@ -735,6 +735,7 @@ std::unordered_set<int64_t>
SchemaChangeHandler::_tablet_ids_in_converting;
// The admin should upgrade all BE and then upgrade FE.
// Should delete the old code after upgrade finished.
Status SchemaChangeHandler::_do_process_alter_tablet_v2(const
TAlterTabletReqV2& request) {
Review Comment:
warning: function '_do_process_alter_tablet_v2' has cognitive complexity of
66 (threshold 50) [readability-function-cognitive-complexity]
```cpp
Status SchemaChangeHandler::_do_process_alter_tablet_v2(const
TAlterTabletReqV2& request) {
^
```
<details>
<summary>Additional context</summary>
**be/src/olap/schema_change.cpp:737:** +1, including nesting penalty of 0,
nesting level increased to 1
```cpp
DBUG_EXECUTE_IF("SchemaChangeJob._do_process_alter_tablet.sleep", {
sleep(10); })
^
```
**be/src/util/debug_points.h:36:** expanded from macro 'DBUG_EXECUTE_IF'
```cpp
if (UNLIKELY(config::enable_debug_points)) {
\
^
```
**be/src/olap/schema_change.cpp:737:** +2, including nesting penalty of 1,
nesting level increased to 2
```cpp
DBUG_EXECUTE_IF("SchemaChangeJob._do_process_alter_tablet.sleep", {
sleep(10); })
^
```
**be/src/util/debug_points.h:38:** expanded from macro 'DBUG_EXECUTE_IF'
```cpp
if (dp) {
\
^
```
**be/src/olap/schema_change.cpp:741:** +1, including nesting penalty of 0,
nesting level increased to 1
```cpp
if (base_tablet == nullptr) {
^
```
**be/src/olap/schema_change.cpp:751:** +1, including nesting penalty of 0,
nesting level increased to 1
```cpp
if (new_tablet == nullptr) {
^
```
**be/src/olap/schema_change.cpp:758:** +1, including nesting penalty of 0,
nesting level increased to 1
```cpp
if (new_tablet->tablet_state() != TABLET_NOTREADY) {
^
```
**be/src/olap/schema_change.cpp:779:** +1, including nesting penalty of 0,
nesting level increased to 1
```cpp
if (!base_migration_rlock.owns_lock()) {
^
```
**be/src/olap/schema_change.cpp:784:** +1, including nesting penalty of 0,
nesting level increased to 1
```cpp
if (!new_migration_rlock.owns_lock()) {
^
```
**be/src/olap/schema_change.cpp:801:** +1, including nesting penalty of 0,
nesting level increased to 1
```cpp
if (!request.columns.empty() && request.columns[0].col_unique_id >= 0) {
^
```
**be/src/olap/schema_change.cpp:801:** +1
```cpp
if (!request.columns.empty() && request.columns[0].col_unique_id >= 0) {
^
```
**be/src/olap/schema_change.cpp:814:** +1, including nesting penalty of 0,
nesting level increased to 1
```cpp
size_t num_cols = request.columns.empty() ?
base_tablet->tablet_schema()->num_columns()
^
```
**be/src/olap/schema_change.cpp:817:** +1, including nesting penalty of 0,
nesting level increased to 1
```cpp
for (int i = 0; i < num_cols; ++i) {
^
```
**be/src/olap/schema_change.cpp:827:** nesting level increased to 1
```cpp
SCOPED_SIMPLE_TRACE_IF_TIMEOUT(TRACE_TABLET_LOCK_THRESHOLD);
^
```
**be/src/util/trace.h:32:** expanded from macro
'SCOPED_SIMPLE_TRACE_IF_TIMEOUT'
```cpp
SCOPED_SIMPLE_TRACE_TO_STREAM_IF_TIMEOUT(timeout, LOG(WARNING))
^
```
**be/src/util/trace.h:44:** expanded from macro
'SCOPED_SIMPLE_TRACE_TO_STREAM_IF_TIMEOUT'
```cpp
SCOPED_CLEANUP({
\
^
```
**be/src/util/scoped_cleanup.h:33:** expanded from macro 'SCOPED_CLEANUP'
```cpp
auto VARNAME_LINENUM(scoped_cleanup) = MakeScopedCleanup([&] { func_body
});
^
```
**be/src/olap/schema_change.cpp:827:** +2, including nesting penalty of 1,
nesting level increased to 2
```cpp
SCOPED_SIMPLE_TRACE_IF_TIMEOUT(TRACE_TABLET_LOCK_THRESHOLD);
^
```
**be/src/util/trace.h:32:** expanded from macro
'SCOPED_SIMPLE_TRACE_IF_TIMEOUT'
```cpp
SCOPED_SIMPLE_TRACE_TO_STREAM_IF_TIMEOUT(timeout, LOG(WARNING))
^
```
**be/src/util/trace.h:49:** expanded from macro
'SCOPED_SIMPLE_TRACE_TO_STREAM_IF_TIMEOUT'
```cpp
if (VARNAME_LINENUM(cost_us) >= VARNAME_LINENUM(timeout_us)) {
\
^
```
**be/src/olap/schema_change.cpp:830:** +1, including nesting penalty of 0,
nesting level increased to 1
```cpp
do {
^
```
**be/src/olap/schema_change.cpp:834:** +2, including nesting penalty of 1,
nesting level increased to 2
```cpp
if (!res) {
^
```
**be/src/olap/schema_change.cpp:839:** +2, including nesting penalty of 1,
nesting level increased to 2
```cpp
DBUG_EXECUTE_IF("SchemaChangeJob.process_alter_tablet.alter_fail", {
^
```
**be/src/util/debug_points.h:36:** expanded from macro 'DBUG_EXECUTE_IF'
```cpp
if (UNLIKELY(config::enable_debug_points)) {
\
^
```
**be/src/olap/schema_change.cpp:839:** +3, including nesting penalty of 2,
nesting level increased to 3
```cpp
DBUG_EXECUTE_IF("SchemaChangeJob.process_alter_tablet.alter_fail", {
^
```
**be/src/util/debug_points.h:38:** expanded from macro 'DBUG_EXECUTE_IF'
```cpp
if (dp) {
\
^
```
**be/src/olap/schema_change.cpp:848:** +2, including nesting penalty of 1,
nesting level increased to 2
```cpp
if (max_rowset == nullptr || max_rowset->end_version() <
request.alter_version) {
^
```
**be/src/olap/schema_change.cpp:848:** +1
```cpp
if (max_rowset == nullptr || max_rowset->end_version() <
request.alter_version) {
^
```
**be/src/olap/schema_change.cpp:851:** +3, including nesting penalty of 2,
nesting level increased to 3
```cpp
(max_rowset == nullptr ? 0 :
max_rowset->end_version()),
^
```
**be/src/olap/schema_change.cpp:898:** +2, including nesting penalty of 1,
nesting level increased to 2
```cpp
RETURN_IF_ERROR(base_tablet->capture_rs_readers(versions_to_be_changed,
&rs_splits));
^
```
**be/src/common/status.h:619:** expanded from macro 'RETURN_IF_ERROR'
```cpp
do { \
^
```
**be/src/olap/schema_change.cpp:898:** +3, including nesting penalty of 2,
nesting level increased to 3
```cpp
RETURN_IF_ERROR(base_tablet->capture_rs_readers(versions_to_be_changed,
&rs_splits));
^
```
**be/src/common/status.h:621:** expanded from macro 'RETURN_IF_ERROR'
```cpp
if (UNLIKELY(!_status_.ok())) { \
^
```
**be/src/olap/schema_change.cpp:899:** +2, including nesting penalty of 1,
nesting level increased to 2
```cpp
if (rs_splits.empty()) {
^
```
**be/src/olap/schema_change.cpp:915:** +2, including nesting penalty of 1,
nesting level increased to 2
```cpp
if (!res) {
^
```
**be/src/olap/schema_change.cpp:941:** +1, including nesting penalty of 0,
nesting level increased to 1
```cpp
do {
^
```
**be/src/olap/schema_change.cpp:942:** +2, including nesting penalty of 1,
nesting level increased to 2
```cpp
if (!res) {
^
```
**be/src/olap/schema_change.cpp:947:** +2, including nesting penalty of 1,
nesting level increased to 2
```cpp
RETURN_IF_ERROR(
^
```
**be/src/common/status.h:619:** expanded from macro 'RETURN_IF_ERROR'
```cpp
do { \
^
```
**be/src/olap/schema_change.cpp:947:** +3, including nesting penalty of 2,
nesting level increased to 3
```cpp
RETURN_IF_ERROR(
^
```
**be/src/common/status.h:621:** expanded from macro 'RETURN_IF_ERROR'
```cpp
if (UNLIKELY(!_status_.ok())) { \
^
```
**be/src/olap/schema_change.cpp:965:** +2, including nesting penalty of 1,
nesting level increased to 2
```cpp
switch (request.alter_tablet_type) {
^
```
**be/src/olap/schema_change.cpp:976:** +2, including nesting penalty of 1,
nesting level increased to 2
```cpp
if (request.__isset.materialized_view_params) {
^
```
**be/src/olap/schema_change.cpp:998:** +2, including nesting penalty of 1,
nesting level increased to 2
```cpp
if (!res) {
^
```
**be/src/olap/schema_change.cpp:1004:** +2, including nesting penalty of 1,
nesting level increased to 2
```cpp
if (new_tablet->keys_type() == UNIQUE_KEYS &&
^
```
**be/src/olap/schema_change.cpp:1007:** +3, including nesting penalty of 2,
nesting level increased to 3
```cpp
if (!res) {
^
```
**be/src/olap/schema_change.cpp:1010:** +1, nesting level increased to 2
```cpp
} else {
^
```
**be/src/olap/schema_change.cpp:1013:** nesting level increased to 3
```cpp
SCOPED_SIMPLE_TRACE_IF_TIMEOUT(TRACE_TABLET_LOCK_THRESHOLD);
^
```
**be/src/util/trace.h:32:** expanded from macro
'SCOPED_SIMPLE_TRACE_IF_TIMEOUT'
```cpp
SCOPED_SIMPLE_TRACE_TO_STREAM_IF_TIMEOUT(timeout, LOG(WARNING))
^
```
**be/src/util/trace.h:44:** expanded from macro
'SCOPED_SIMPLE_TRACE_TO_STREAM_IF_TIMEOUT'
```cpp
SCOPED_CLEANUP({
\
^
```
**be/src/util/scoped_cleanup.h:33:** expanded from macro 'SCOPED_CLEANUP'
```cpp
auto VARNAME_LINENUM(scoped_cleanup) = MakeScopedCleanup([&] { func_body
});
^
```
**be/src/olap/schema_change.cpp:1013:** +4, including nesting penalty of 3,
nesting level increased to 4
```cpp
SCOPED_SIMPLE_TRACE_IF_TIMEOUT(TRACE_TABLET_LOCK_THRESHOLD);
^
```
**be/src/util/trace.h:32:** expanded from macro
'SCOPED_SIMPLE_TRACE_IF_TIMEOUT'
```cpp
SCOPED_SIMPLE_TRACE_TO_STREAM_IF_TIMEOUT(timeout, LOG(WARNING))
^
```
**be/src/util/trace.h:49:** expanded from macro
'SCOPED_SIMPLE_TRACE_TO_STREAM_IF_TIMEOUT'
```cpp
if (VARNAME_LINENUM(cost_us) >= VARNAME_LINENUM(timeout_us)) {
\
^
```
**be/src/olap/schema_change.cpp:1015:** +3, including nesting penalty of 2,
nesting level increased to 3
```cpp
if (!res) {
^
```
**be/src/olap/schema_change.cpp:1022:** +1, including nesting penalty of 0,
nesting level increased to 1
```cpp
if (res) {
^
```
**be/src/olap/schema_change.cpp:1029:** +1, including nesting penalty of 0,
nesting level increased to 1
```cpp
if (!res) {
^
```
</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]