Gabriel39 commented on code in PR #45614: URL: https://github.com/apache/doris/pull/45614#discussion_r1899896621
########## be/src/pipeline/task_scheduler.cpp: ########## @@ -94,21 +98,32 @@ void _close_task(PipelineTask* task, Status exec_status) { } task->finalize(); task->set_running(false); + { + auto expected = TaskState::RUNNING; + CHECK(holder->state.compare_exchange_strong(expected, TaskState::VALID)); + } task->fragment_context()->close_a_pipeline(task->pipeline_id()); } void TaskScheduler::_do_work(int index) { while (_markers[index]) { - auto* task = _task_queue.take(index); - if (!task) { + auto holder = _task_queue.take(index); + if (!holder) { continue; } - if (task->is_running()) { - static_cast<void>(_task_queue.push_back(task, index)); - continue; + { + auto expected = TaskState::VALID; + if (!holder->state.compare_exchange_strong(expected, TaskState::RUNNING)) { + if (expected == TaskState::RUNNING) { + static_cast<void>(_task_queue.push_back(holder, index)); Review Comment: 不是的,这里是为了防止一个task重复进入调度队列,这里已经放进了预期执行的队列里,只是要等这个task在前一个执行线程退出。 -- 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