AshinGau commented on code in PR #30746: URL: https://github.com/apache/doris/pull/30746#discussion_r1477312581
########## be/src/vec/exec/scan/scanner_context.cpp: ########## @@ -210,148 +136,238 @@ Status ScannerContext::init() { thread_token == nullptr ? "False" : "True"); } + // submit `_max_thread_num` running scanners to `ScannerScheduler` + // When a running scanners is finished, it will submit one of the remaining scanners. + for (int i = 0; i < _max_thread_num; ++i) { + std::weak_ptr<ScannerDelegate> next_scanner; + if (_scanners.try_dequeue(next_scanner)) { + vectorized::BlockUPtr block = get_free_block(_batch_size); + submit_running_scanner( + std::make_shared<RunningScanner>(next_scanner, std::move(block))); + _num_running_scanners++; + } + } + return Status::OK(); } std::string ScannerContext::parent_name() { return _parent ? _parent->get_name() : _local_state->get_name(); } -vectorized::BlockUPtr ScannerContext::get_free_block() { +vectorized::BlockUPtr ScannerContext::get_free_block(int batch_size) { vectorized::BlockUPtr block; if (_free_blocks.try_dequeue(block)) { + std::lock_guard<std::mutex> fl(_free_blocks_lock); Review Comment: make `_free_blocks_memory_usage` accurate -- 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