yiguolei commented on code in PR #31106: URL: https://github.com/apache/doris/pull/31106#discussion_r1494330962
########## be/src/vec/exec/scan/scanner_scheduler.h: ########## @@ -128,27 +124,32 @@ class SimplifiedScanScheduler { .set_max_threads(config::doris_scanner_thread_pool_thread_num) .set_cgroup_cpu_ctl(_cgroup_cpu_ctl) .build(&_scan_thread_pool)); - - for (int i = 0; i < config::doris_scanner_thread_pool_thread_num; i++) { - RETURN_IF_ERROR(_scan_thread_pool->submit_func([this] { this->_work(); })); - } return Status::OK(); } - BlockingQueue<SimplifiedScanTask>* get_scan_queue() { return _scan_task_queue.get(); } + Status submit_scan_task(SimplifiedScanTask scan_task) { + if (!_is_stop) { + return _scan_thread_pool->submit_func([scan_task] { scan_task.scan_func(); }); + } else { + return Status::InternalError<false>("scanner pool {} is shutdown.", _wg_name); + } + } -private: - void _work() { - while (!_is_stop.load()) { - SimplifiedScanTask scan_task; - if (_scan_task_queue->blocking_get(&scan_task)) { - scan_task.scan_func(); - }; + void reset_thread_num(int thread_num) { + int max_thread_num = _scan_thread_pool->max_threads(); + if (max_thread_num != thread_num) { + if (thread_num > max_thread_num) { + static_cast<void>(_scan_thread_pool->set_max_threads(thread_num)); Review Comment: Maybe failed, because the thread pool will do this check: Status ThreadPool::set_max_threads(int max_threads) { std::lock_guard<std::mutex> l(_lock); if (_min_threads > max_threads) { // max threads can not be set less than min threads return Status::InternalError("set thread pool {} max_threads failed", _name); } -- 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