kaijchen commented on code in PR #33325:
URL: https://github.com/apache/doris/pull/33325#discussion_r1579389889
##########
be/src/olap/memtable_flush_executor.cpp:
##########
@@ -203,15 +203,20 @@ void
FlushToken::_flush_memtable(std::unique_ptr<MemTable> memtable_ptr, int32_t
void MemTableFlushExecutor::init(int num_disk) {
num_disk = std::max(1, num_disk);
- size_t min_threads = std::max(1, config::flush_thread_num_per_store);
- size_t max_threads = num_disk * min_threads;
+ int num_cpus = std::thread::hardware_concurrency();
+ // hardware_concurrency() may return 0, assume a high limit if this happens
+ num_cpus = num_cpus ? num_cpus : 10000;
+ int min_threads = std::max(1, config::flush_thread_num_per_store);
+ int max_threads =
+ std::min(num_disk * min_threads, num_cpus *
config::max_flush_thread_num_per_cpu);
Review Comment:
```suggestion
int num_cpus = std::thread::hardware_concurrency();
int min_threads = std::max(1, config::flush_thread_num_per_store);
int max_threads = num_cpus == 0 ? num_disk * min_threads :
std::min(num_disk * min_threads, num_cpus *
config::max_flush_thread_num_per_cpu);
```
--
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]