HappenLee commented on code in PR #48948: URL: https://github.com/apache/doris/pull/48948#discussion_r1995231172
########## be/src/vec/sink/writer/async_result_writer.cpp: ########## @@ -130,42 +137,49 @@ void AsyncResultWriter::process_block(RuntimeState* state, RuntimeProfile* profi } DCHECK(_dependency); - if (_writer_status.ok()) { - while (true) { - ThreadCpuStopWatch cpu_time_stop_watch; - cpu_time_stop_watch.start(); - Defer defer {[&]() { - if (state && state->get_query_ctx()) { - state->get_query_ctx()->resource_ctx()->cpu_context()->update_cpu_cost_ms( - cpu_time_stop_watch.elapsed_time()); - } - }}; - if (!_eos && _data_queue.empty() && _writer_status.ok()) { - std::unique_lock l(_m); - while (!_eos && _data_queue.empty() && _writer_status.ok()) { - // Add 1s to check to avoid lost signal - _cv.wait_for(l, std::chrono::seconds(1)); - } + while (_writer_status.ok()) { + ThreadCpuStopWatch cpu_time_stop_watch; + cpu_time_stop_watch.start(); + Defer defer {[&]() { + if (state && state->get_query_ctx()) { + state->get_query_ctx()->resource_ctx()->cpu_context()->update_cpu_cost_ms( + cpu_time_stop_watch.elapsed_time()); } + }}; - if ((_eos && _data_queue.empty()) || !_writer_status.ok()) { - _data_queue.clear(); - break; + //1) wait scan operator write data Review Comment: better do the change: ``` { std::unique_lock l(_m); while (!_eos && _data_queue.empty() && _writer_status.ok()) { // Add 1s to check to avoid lost signal _cv.wait_for(l, std::chrono::seconds(1)); } if ((_eos && _data_queue.empty()) || !_writer_status.ok()) { _data_queue.clear(); break; } } ``` -- 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