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


##########
be/src/pipeline/pipeline_task.cpp:
##########
@@ -480,7 +470,10 @@ Status PipelineTask::close(Status exec_status) {
     Status s;
     {
         SCOPED_RAW_TIMER(&close_ns);
-        s = _sink->close(_state, exec_status);
+        if (close_sink) {
+            _task_profile->add_info_string("WakeUpEarly", wake_up_early() ? 
"true" : "false");
+            s = _sink->close(_state, exec_status);
+        }
         for (auto& op : _operators) {
             auto tem = op->close(_state);

Review Comment:
   这个close 函数,如果被调用2次,中间这些update statistics 都不一定能够重入。
   我们这么改:
   if (!close_sink) {
         for (auto& op : _operators) {}
   } else {
       int64_t close_ns = 0;
       Defer defer {[&]() {
           if (_task_queue) {
               _task_queue->update_statistics(this, close_ns);
           }
       }};
       Status s;
       {
           SCOPED_RAW_TIMER(&close_ns);
           if (close_sink) {
               _task_profile->add_info_string("WakeUpEarly", wake_up_early() ? 
"true" : "false");
               s = _sink->close(_state, exec_status);
           }
          }
       if (_opened) {
           _fresh_profile_counter();
           COUNTER_SET(_close_timer, close_ns);
           COUNTER_UPDATE(_task_profile->total_time_counter(), close_ns);
       }
       return s;
   }



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