vagetablechicken commented on a change in pull request #5111: URL: https://github.com/apache/incubator-doris/pull/5111#discussion_r548948800
########## File path: be/src/exec/olap_scan_node.cpp ########## @@ -1250,12 +1250,25 @@ void OlapScanNode::transfer_thread(RuntimeState* state) { state->resource_pool()->release_thread_token(true); VLOG(1) << "TransferThread finish."; - std::unique_lock<std::mutex> l(_row_batches_lock); - _transfer_done = true; + { + std::unique_lock<std::mutex> l(_row_batches_lock); + _transfer_done = true; + } _row_batch_added_cv.notify_all(); + + std::unique_lock<std::mutex> l(_scan_batches_lock); + while (_running_thread != 0) { + l.unlock(); + SleepFor(MonoDelta::FromMilliseconds(5)); + l.lock(); Review comment: I don't want use `_scan_batch_added_cv`, it's hard to understand the relationship between `_scan_batch_added_cv` & `_running_thread `. I'll add a new condition variable. ---------------------------------------------------------------- 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