morningman commented on a change in pull request #5781: URL: https://github.com/apache/incubator-doris/pull/5781#discussion_r656709944
########## File path: be/src/olap/olap_server.cpp ########## @@ -334,6 +334,30 @@ void StorageEngine::_compaction_tasks_producer_callback() { int64_t interval = config::generate_compaction_tasks_min_interval_ms; do { if (!config::disable_auto_compaction) { + VLOG_CRITICAL << "compaction thread pool. num_threads: " << _compaction_thread_pool->num_threads() + << ", num_threads_pending_start: " << _compaction_thread_pool->num_threads_pending_start() + << ", num_active_threads: " << _compaction_thread_pool->num_active_threads() + << ", max_threads: " << _compaction_thread_pool->max_threads() + << ", min_threads: " << _compaction_thread_pool->min_threads() + << ", num_total_queued_tasks: " << _compaction_thread_pool->num_total_queued_tasks(); + + if(_compaction_thread_pool->max_threads() != config::max_compaction_threads) { + Status status = _compaction_thread_pool->set_max_threads(config::max_compaction_threads); + if (status.ok()) { Review comment: what if it returns failure? ########## File path: be/src/olap/olap_server.cpp ########## @@ -334,6 +334,30 @@ void StorageEngine::_compaction_tasks_producer_callback() { int64_t interval = config::generate_compaction_tasks_min_interval_ms; do { if (!config::disable_auto_compaction) { + VLOG_CRITICAL << "compaction thread pool. num_threads: " << _compaction_thread_pool->num_threads() + << ", num_threads_pending_start: " << _compaction_thread_pool->num_threads_pending_start() + << ", num_active_threads: " << _compaction_thread_pool->num_active_threads() + << ", max_threads: " << _compaction_thread_pool->max_threads() + << ", min_threads: " << _compaction_thread_pool->min_threads() + << ", num_total_queued_tasks: " << _compaction_thread_pool->num_total_queued_tasks(); + + if(_compaction_thread_pool->max_threads() != config::max_compaction_threads) { + Status status = _compaction_thread_pool->set_max_threads(config::max_compaction_threads); + if (status.ok()) { + LOG(INFO) << "update compaction thread pool max_threads from " + << _compaction_thread_pool->max_threads() << " to " + << config::max_compaction_threads; + } + } + if(_compaction_thread_pool->min_threads() != config::max_compaction_threads) { + Status status = _compaction_thread_pool->set_min_threads(config::max_compaction_threads); + if (status.ok()) { Review comment: what if it returns failure? ########## File path: be/src/util/threadpool.cpp ########## @@ -610,6 +607,35 @@ void ThreadPool::check_not_pool_thread_unlocked() { } } +Status ThreadPool::set_min_threads(int min_threads) { + if (min_threads <= _max_threads) { + int old_min_threads = _min_threads; Review comment: `old_min_threads` seems useless. ########## File path: be/src/util/threadpool.cpp ########## @@ -610,6 +607,35 @@ void ThreadPool::check_not_pool_thread_unlocked() { } } +Status ThreadPool::set_min_threads(int min_threads) { + if (min_threads <= _max_threads) { + int old_min_threads = _min_threads; + _min_threads = min_threads; + if (min_threads > _num_threads + _num_threads_pending_start) { + int addition_threads = min_threads - _num_threads - _num_threads_pending_start; + _num_threads_pending_start += addition_threads; + for (int i = 0; i < addition_threads; i++) { + Status status = create_thread(); + if (!status.ok()) { + _num_threads_pending_start--; + LOG(ERROR) << "Thread pool failed to create thread: " << status.to_string(); Review comment: use WARNING -- 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. 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