You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ma...@apache.org on 2026/07/07 07:32:49 UTC

(flink) branch master updated: [FLINK-40068][tests] Do not assert apply() was called when cancelling KeyedJob window

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

MartijnVisser pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new a053de2138e [FLINK-40068][tests] Do not assert apply() was called when cancelling KeyedJob window
a053de2138e is described below

commit a053de2138e6ceeaa1cef73f6d99981bd823e9cb
Author: Martijn Visser <29...@users.noreply.github.com>
AuthorDate: Fri Jul 3 21:31:15 2026 +0200

    [FLINK-40068][tests] Do not assert apply() was called when cancelling KeyedJob window
    
    StatefulWindowFunction.close() also runs on the cancellation path, and the GENERATE/MIGRATE jobs are always stopped via non-draining cancel-with-savepoint, so a window subtask can be closed before apply() was called; the failing assertion then kills the shared MiniCluster's only TaskManager and starves every later parameterization. Restrict the assertion to RESTORE, the only mode whose job runs to completion.
    
    Generated-by: Claude Opus 4.8 (1M context)
---
 .../apache/flink/test/state/operator/restore/keyed/KeyedJob.java    | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/flink-tests/src/test/java/org/apache/flink/test/state/operator/restore/keyed/KeyedJob.java b/flink-tests/src/test/java/org/apache/flink/test/state/operator/restore/keyed/KeyedJob.java
index 58a47f5bafa..1713db4e78a 100644
--- a/flink-tests/src/test/java/org/apache/flink/test/state/operator/restore/keyed/KeyedJob.java
+++ b/flink-tests/src/test/java/org/apache/flink/test/state/operator/restore/keyed/KeyedJob.java
@@ -214,7 +214,11 @@ public class KeyedJob {
 
         @Override
         public void close() {
-            assertThat(applyCalled).as("Apply was never called.").isTrue();
+            // GENERATE/MIGRATE stop via non-draining cancel-with-savepoint, so a subtask may
+            // close before apply() ran; only RESTORE runs to completion.
+            if (mode == ExecutionMode.RESTORE) {
+                assertThat(applyCalled).as("Apply was never called.").isTrue();
+            }
         }
     }