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/29 12:40:09 UTC

(flink) 04/04: [FLINK-40067][tests] Fix race in RescaleTimelineITCase.testRescaleTerminatedByJobFinished

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

XComp pushed a commit to branch release-2.3
in repository https://gitbox.apache.org/repos/asf/flink.git

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

    [FLINK-40067][tests] Fix race in RescaleTimelineITCase.testRescaleTerminatedByJobFinished
    
    On a loaded machine the cooldown-driven Idling transition terminates the in-progress rescale with NO_RESOURCES_OR_PARALLELISMS_CHANGE before the job finishes, so goToFinished's later JOB_FINISHED stamp is dropped and the wait can never succeed. Widen the fixture cooldown to keep the rescale in-progress until the job finishes, mirroring FLINK-39903/FLINK-40010.
    
    Generated-by: Claude Opus 4.8 (1M context)
    (cherry picked from commit edba4901475bfd0696d4e95f1c9ca049924b7a81)
---
 .../adaptive/timeline/RescaleTimelineITCase.java         | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/timeline/RescaleTimelineITCase.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/timeline/RescaleTimelineITCase.java
index 96328abf426..e5920f282cb 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/timeline/RescaleTimelineITCase.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/timeline/RescaleTimelineITCase.java
@@ -269,6 +269,17 @@ class RescaleTimelineITCase {
 
     @TestTemplate
     void testRescaleTerminatedByJobFinished() throws Exception {
+        // This case only asserts on the recorded rescale history; skip the disabled-history
+        // parameter before the cluster rebuild below so it does not pay for an unused cluster.
+        assumeThat(enabledRescaleHistory(configuration)).isTrue();
+
+        // With the short shared cooldown the DefaultStateTransitionManager re-enters Idling on a
+        // wall-clock timer and terminates the in-progress rescale with
+        // NO_RESOURCES_OR_PARALLELISMS_CHANGE before the job finishes; goToFinished then finds it
+        // already terminated and its JOB_FINISHED stamp is ignored, so waiting cannot win.
+        // Widen the cooldown to keep the rescale in-progress until the job finishes.
+        rebuildClusterWithExecutingTimeouts(Duration.ofSeconds(60), Duration.ofSeconds(60));
+
         final MiniCluster miniCluster = miniClusterResource.getMiniCluster();
         final JobGraph jobGraph = createBlockingJobGraph(PARALLELISM);
 
@@ -276,8 +287,6 @@ class RescaleTimelineITCase {
 
         waitForVertexParallelismReachedAndJobRunning(jobGraph, JOB_VERTEX_ID, PARALLELISM);
 
-        assumeThat(enabledRescaleHistory(configuration)).isTrue();
-
         updateJobResourceRequirements(miniCluster, jobGraph, 1, PARALLELISM * 2);
 
         // The upper bound (PARALLELISM * 2) exceeds the available slots, so this rescale is only
@@ -289,13 +298,14 @@ class RescaleTimelineITCase {
 
         OnceBlockingNoOpInvokable.unblock();
 
+        // Generous budget: on a loaded CI leg the unblock-to-finish window can itself exceed 10s.
         waitUntilConditionWithTimeout(
                 () -> {
                     List<Rescale> rescaleHistory = getRescaleHistory(miniCluster, jobGraph);
                     return hasRescaleHistoryMetCondition(
                             rescaleHistory, 2, TerminatedReason.JOB_FINISHED);
                 },
-                10000);
+                60000);
     }
 
     @TestTemplate