AshinGau commented on code in PR #10942:
URL: https://github.com/apache/doris/pull/10942#discussion_r923045171


##########
be/src/vec/exec/file_scan_node.cpp:
##########
@@ -100,9 +102,33 @@ Status FileScanNode::start_scanners() {
     }
 
     _scanners_status.resize(_scan_ranges.size());
+    ThreadPoolToken* thread_token = 
_runtime_state->get_query_fragments_ctx()->get_token();
+    PriorityThreadPool* thread_pool = 
_runtime_state->exec_env()->scan_thread_pool();
     for (int i = 0; i < _scan_ranges.size(); i++) {
-        _scanner_threads.emplace_back(&FileScanNode::scanner_worker, this, i, 
_scan_ranges.size(),
-                                      std::ref(_scanners_status[i]));
+        Status submit_status = Status::OK();
+        if (thread_token != nullptr) {
+            submit_status = 
thread_token->submit_func(std::bind(&FileScanNode::scanner_worker, this,
+                                                                i, 
_scan_ranges.size(),
+                                                                
std::ref(_scanners_status[i])));
+        } else {
+            PriorityThreadPool::WorkFunction task =
+                    std::bind(&FileScanNode::scanner_worker, this, i, 
_scan_ranges.size(),
+                              std::ref(_scanners_status[i]));
+            if (!thread_pool->offer(task)) {
+                submit_status = Status::Cancelled("Failed to submit scan 
task");
+            }
+        }
+        if (!submit_status.ok()) {
+            LOG(FATAL) << "Failed to assign file scanner task to thread pool! "

Review Comment:
   done



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