github-actions[bot] commented on code in PR #66913:
URL: https://github.com/apache/doris/pull/66913#discussion_r3859419004


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/SplitAssignment.java:
##########
@@ -191,11 +191,16 @@ public void finishSchedule() {
     }
 
     public void stop() {
-        if (isStop()) {
-            return;
+        List<Closeable> resources;
+        synchronized (closeableResources) {
+            if (isStop()) {
+                return;
+            }
+            isStopped.set(true);

Review Comment:
   [P1] Keep stop from aborting its callers' cleanup
   
   Hudi now records the first batch-planning failure in this assignment before 
cancellation. `stop()` still rethrows that stored exception after it marks the 
assignment stopped and closes its handles, so `FileQueryScanNode.stop()` never 
reaches split-source removal; the classic and Nereids coordinator cancellation 
loops can also exit before stopping later scan nodes or publishing/sending the 
query cancellation. Make this cleanup path no-throw (split fetching already 
surfaces the planning error), or isolate all remaining caller cleanup in 
`finally`, and add an error-then-stop test proving every source and sibling 
scan node is cleaned.



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/DorisHiveCatalog.java:
##########
@@ -0,0 +1,77 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.datasource.iceberg;
+
+import org.apache.iceberg.hive.HiveCatalog;
+import org.apache.iceberg.io.FileIO;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+/** Owns and closes the shared FileIO created by one Iceberg HiveCatalog 
generation. */
+public class DorisHiveCatalog extends HiveCatalog {
+    private final AtomicBoolean closed = new AtomicBoolean();
+    private FileIO ownedFileIO;
+
+    @Override
+    public void initialize(String name, Map<String, String> properties) {
+        super.initialize(name, properties);
+        ownedFileIO = extractFileIO();
+    }
+
+    @Override
+    public void close() throws IOException {
+        if (!closed.compareAndSet(false, true)) {
+            return;
+        }
+        IOException closeFailure = null;
+        try {
+            super.close();

Review Comment:
   [P1] Always close the owned FileIO after inherited cleanup
   
   The one-shot `closed` flag is set before this call, but only `IOException` 
is caught. Iceberg 1.10.1 delegates `BaseMetastoreCatalog.close()` to the 
configured metrics reporter, whose implementation may throw an unchecked 
exception; that exits before `ownedFileIO.close()`, and every later close 
becomes a no-op. Put the owned-FileIO leg in failure-atomic 
`finally`/aggregation logic and add a regression with a throwing configured 
reporter.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to