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


##########
be/src/runtime/routine_load/routine_load_task_executor.cpp:
##########
@@ -412,6 +388,34 @@
     cb(ctx);
 }
 
+Status RoutineLoadTaskExecutor::offer_task(std::shared_ptr<StreamLoadContext> 
ctx) {
+   VLOG_CRITICAL << "receive a new routine load task: " << ctx->brief();
+    // register the task
+    _task_map[ctx->id] = ctx;
+
+    // offer the task to thread pool
+    if (!_thread_pool.offer(std::bind<void>(
+                &RoutineLoadTaskExecutor::exec_task, this, ctx, 
&_data_consumer_pool,
+                [this](std::shared_ptr<StreamLoadContext> ctx) {
+                    std::unique_lock<std::mutex> l(_lock);
+                    ctx->exec_env()->new_load_stream_mgr()->remove(ctx->id);
+                    _task_map.erase(ctx->id);
+                    LOG(INFO) << "finished routine load task " << ctx->brief()
+                              << ", status: " << ctx->status
+                              << ", current tasks num: " << _task_map.size();
+                }))) {
+        // failed to submit task, clear and return
+        LOG(WARNING) << "failed to submit routine load task: " << ctx->brief();
+        ctx->exec_env()->new_load_stream_mgr()->remove(ctx->id);
+        _task_map.erase(ctx->id);
+        return Status::InternalError("failed to submit routine load task");
+    } else {
+        LOG(INFO) << "submit a new routine load task: " << ctx->brief()
+                  << ", current tasks num: " << _task_map.size();
+        return Status::OK();
+    }

Review Comment:
   warning: do not use 'else' after 'return' [readability-else-after-return]
   
   ```suggestion
       }         LOG(INFO) << "submit a new routine load task: " << ctx->brief()
                     << ", current tasks num: " << _task_map.size();
           return Status::OK();
      
   ```
   



##########
be/src/service/backend_service.h:
##########
@@ -18,6 +18,7 @@
 #pragma once
 
 #include <gen_cpp/BackendService.h>

Review Comment:
   warning: 'gen_cpp/BackendService.h' file not found [clang-diagnostic-error]
   ```cpp
   #include <gen_cpp/BackendService.h>
            ^
   ```
   



##########
be/src/runtime/routine_load/routine_load_task_executor.cpp:
##########
@@ -412,6 +388,34 @@ void 
RoutineLoadTaskExecutor::exec_task(std::shared_ptr<StreamLoadContext> ctx,
     cb(ctx);
 }
 
+Status RoutineLoadTaskExecutor::offer_task(std::shared_ptr<StreamLoadContext> 
ctx) {

Review Comment:
   warning: method 'offer_task' can be made static 
[readability-convert-member-functions-to-static]
   
   be/src/runtime/routine_load/routine_load_task_executor.h:67:
   ```diff
   -     Status offer_task(std::shared_ptr<StreamLoadContext> ctx);
   +     static Status offer_task(std::shared_ptr<StreamLoadContext> ctx);
   ```
   



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