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


##########
be/src/olap/schema_change.cpp:
##########
@@ -777,6 +777,7 @@ SchemaChangeJob::SchemaChangeJob(StorageEngine& 
local_storage_engine,
 // The admin should upgrade all BE and then upgrade FE.
 // Should delete the old code after upgrade finished.
 Status SchemaChangeJob::_do_process_alter_tablet(const TAlterTabletReqV2& 
request) {

Review Comment:
   warning: function '_do_process_alter_tablet' has cognitive complexity of 66 
(threshold 50) [readability-function-cognitive-complexity]
   ```cpp
   Status SchemaChangeJob::_do_process_alter_tablet(const TAlterTabletReqV2& 
request) {
                           ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/olap/schema_change.cpp:779:** +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:779:** +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:785:** +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:806:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       if (!base_migration_rlock.owns_lock()) {
       ^
   ```
   **be/src/olap/schema_change.cpp:811:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       if (!new_migration_rlock.owns_lock()) {
       ^
   ```
   **be/src/olap/schema_change.cpp:833:** +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:843:** nesting level increased to 1
   ```cpp
           SCOPED_SIMPLE_TRACE_IF_TIMEOUT(TRACE_TABLET_LOCK_THRESHOLD);
           ^
   ```
   **be/src/util/trace.h:31:** expanded from macro 
'SCOPED_SIMPLE_TRACE_IF_TIMEOUT'
   ```cpp
       SCOPED_SIMPLE_TRACE_TO_STREAM_IF_TIMEOUT(timeout, LOG(WARNING))
       ^
   ```
   **be/src/util/trace.h:43:** 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:843:** +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:31:** expanded from macro 
'SCOPED_SIMPLE_TRACE_IF_TIMEOUT'
   ```cpp
       SCOPED_SIMPLE_TRACE_TO_STREAM_IF_TIMEOUT(timeout, LOG(WARNING))
       ^
   ```
   **be/src/util/trace.h:48:** 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:846:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
           do {
           ^
   ```
   **be/src/olap/schema_change.cpp:850:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
               if (!res) {
               ^
   ```
   **be/src/olap/schema_change.cpp:855:** +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:855:** +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:864:** +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:864:** +1
   ```cpp
               if (max_rowset == nullptr || max_rowset->end_version() < 
request.alter_version) {
                                         ^
   ```
   **be/src/olap/schema_change.cpp:867:** +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:897:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
               RETURN_IF_ERROR(_new_tablet->modify_rowsets(empty_vec, 
rowsets_to_delete));
               ^
   ```
   **be/src/common/status.h:628:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/olap/schema_change.cpp:897:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               RETURN_IF_ERROR(_new_tablet->modify_rowsets(empty_vec, 
rowsets_to_delete));
               ^
   ```
   **be/src/common/status.h:630:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/olap/schema_change.cpp:914:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
               RETURN_IF_ERROR(
               ^
   ```
   **be/src/common/status.h:628:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/olap/schema_change.cpp:914:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               RETURN_IF_ERROR(
               ^
   ```
   **be/src/common/status.h:630:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/olap/schema_change.cpp:916:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
               if (rs_splits.empty()) {
               ^
   ```
   **be/src/olap/schema_change.cpp:932:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
               if (!res) {
               ^
   ```
   **be/src/olap/schema_change.cpp:958:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       do {
       ^
   ```
   **be/src/olap/schema_change.cpp:959:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           if (!res) {
           ^
   ```
   **be/src/olap/schema_change.cpp:964:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           RETURN_IF_ERROR(
           ^
   ```
   **be/src/common/status.h:628:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
       do {                                \
       ^
   ```
   **be/src/olap/schema_change.cpp:964:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
           RETURN_IF_ERROR(
           ^
   ```
   **be/src/common/status.h:630:** expanded from macro 'RETURN_IF_ERROR'
   ```cpp
           if (UNLIKELY(!_status_.ok())) { \
           ^
   ```
   **be/src/olap/schema_change.cpp:973:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           switch (request.alter_tablet_type) {
           ^
   ```
   **be/src/olap/schema_change.cpp:984:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           if (request.__isset.materialized_view_params) {
           ^
   ```
   **be/src/olap/schema_change.cpp:1008:** +2, including nesting penalty of 1, 
nesting level increased to 2
   ```cpp
           if (!res) {
           ^
   ```
   **be/src/olap/schema_change.cpp:1014:** +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:1017:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               if (!res) {
               ^
   ```
   **be/src/olap/schema_change.cpp:1020:** +1, nesting level increased to 2
   ```cpp
           } else {
             ^
   ```
   **be/src/olap/schema_change.cpp:1023:** nesting level increased to 3
   ```cpp
               SCOPED_SIMPLE_TRACE_IF_TIMEOUT(TRACE_TABLET_LOCK_THRESHOLD);
               ^
   ```
   **be/src/util/trace.h:31:** expanded from macro 
'SCOPED_SIMPLE_TRACE_IF_TIMEOUT'
   ```cpp
       SCOPED_SIMPLE_TRACE_TO_STREAM_IF_TIMEOUT(timeout, LOG(WARNING))
       ^
   ```
   **be/src/util/trace.h:43:** 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:1023:** +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:31:** expanded from macro 
'SCOPED_SIMPLE_TRACE_IF_TIMEOUT'
   ```cpp
       SCOPED_SIMPLE_TRACE_TO_STREAM_IF_TIMEOUT(timeout, LOG(WARNING))
       ^
   ```
   **be/src/util/trace.h:48:** 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:1025:** +3, including nesting penalty of 2, 
nesting level increased to 3
   ```cpp
               if (!res) {
               ^
   ```
   **be/src/olap/schema_change.cpp:1032:** +1, including nesting penalty of 0, 
nesting level increased to 1
   ```cpp
       if (res) {
       ^
   ```
   **be/src/olap/schema_change.cpp:1039:** +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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to