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


##########
be/src/pipeline/pipeline_x/dependency.cpp:
##########
@@ -267,11 +267,21 @@ void AggSpillPartition::close() {
 }
 
 void PartitionedAggSharedState::close() {
+    if (is_closed) {
+        return;
+    }
+    is_closed = true;
     for (auto partition : spill_partitions) {
         partition->close();
     }
+    spill_partitions.clear();
 }
-void SpillSortSharedState::clear() {
+
+void SpillSortSharedState::close() {
+    if (is_closed) {

Review Comment:
   这么写是不对的。
   如果2个线程同时到281 行,那么都会认为没有close,结果都跑到285 行执行就报错了。
   需要使用atomic 变量,CAS 机制来实现,不能通过if else 来实现。
   同时这里要加上注释。为啥用CAS



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