This is an automated email from the ASF dual-hosted git repository.

voonhous pushed a commit to branch release-1.2.1
in repository https://gitbox.apache.org/repos/asf/hudi.git

commit c77841848e9cd6e7c1c064275d50e342a15b7f38
Author: Shuo Cheng <[email protected]>
AuthorDate: Thu Jun 11 10:09:22 2026 +0800

    fix(flink): Close write client properly in DefaultCleanHandler (#18940)
    
    (cherry picked from commit 21121acf356179848f7dbbeb1a9f1d5cadd2e756)
---
 .../sink/compact/handler/DefaultCleanHandler.java  |  2 +-
 .../compact/handler/TestDefaultCleanHandler.java   | 41 ++++++++++++++++++++++
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git 
a/hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/compact/handler/DefaultCleanHandler.java
 
b/hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/compact/handler/DefaultCleanHandler.java
index df95b81a06a3..2df75847ddab 100644
--- 
a/hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/compact/handler/DefaultCleanHandler.java
+++ 
b/hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/compact/handler/DefaultCleanHandler.java
@@ -111,6 +111,6 @@ public class DefaultCleanHandler implements CleanHandler {
         throw new HoodieException("Failed to close executor of clean 
handler.", e);
       }
     }
-    this.writeClient.clean();
+    this.writeClient.close();
   }
 }
diff --git 
a/hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/sink/compact/handler/TestDefaultCleanHandler.java
 
b/hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/sink/compact/handler/TestDefaultCleanHandler.java
new file mode 100644
index 000000000000..7c2c5524d49d
--- /dev/null
+++ 
b/hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/sink/compact/handler/TestDefaultCleanHandler.java
@@ -0,0 +1,41 @@
+/*
+ * 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.hudi.sink.compact.handler;
+
+import org.apache.hudi.client.HoodieFlinkWriteClient;
+
+import org.junit.jupiter.api.Test;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+class TestDefaultCleanHandler {
+
+  @Test
+  void testCloseClosesWriteClientWithoutTriggeringClean() {
+    HoodieFlinkWriteClient writeClient = mock(HoodieFlinkWriteClient.class);
+    DefaultCleanHandler handler = new DefaultCleanHandler(writeClient);
+
+    handler.close();
+
+    verify(writeClient).close();
+    verifyNoMoreInteractions(writeClient);
+  }
+}

Reply via email to