yiguolei commented on code in PR #45614:
URL: https://github.com/apache/doris/pull/45614#discussion_r1899886550


##########
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:
   如果状态already 是running了,说明他已经在另外一个队列里被执行了,应该由另外一个队列往里放。



-- 
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

Reply via email to