XComp commented on code in PR #28645:
URL: https://github.com/apache/flink/pull/28645#discussion_r3538774350


##########
flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/timeline/RescaleTimelineITCase.java:
##########
@@ -567,7 +567,21 @@ void 
testRecordNonTerminatedRescaleMergingWithNewRecoverableFailureTriggerCause(
 
         miniCluster.terminateTaskManager(0);
 
-        waitForVertexParallelismReachedAndJobRunning(jobGraph, JOB_VERTEX_ID, 
PARALLELISM);
+        // A parallelism/running wait cannot synchronize with the failover 
here: it is satisfied
+        // immediately by the stale pre-failover state, and the post-failover 
job runs at a lower
+        // parallelism. Instead, wait until the failover has been merged into 
the in-progress
+        // rescale before snapshotting. Guarded by if (not assumeThat) because 
the disabled-history
+        // leg records nothing and must still assert an empty history below.
+        if (enabledRescaleHistory(configuration)) {
+            waitUntilConditionWithTimeout(
+                    () -> {
+                        List<Rescale> rescaleHistory = 
getRescaleHistory(miniCluster, jobGraph);
+                        return rescaleHistory.size() == 2
+                                && rescaleHistory.get(0).getTriggerCause()
+                                        == TriggerCause.RECOVERABLE_FAILOVER;

Review Comment:
   Good point - looking at it once more, I noticed that the fix would be way 
easier:
   
   ```java
   waitForVertexParallelismReachedAndJobRunning(jobGraph, JOB_VERTEX_ID, 
NUMBER_SLOTS_PER_TASK_MANAGER);
   ```
   
   The initial test implementation waited for 4 vertices running which is the 
case before any scaling or failover happens. The wait conditioning is, 
therefore, immediately met. The flakiness in the assert happens depending on 
whether the TaskManager shutdown happens quick enough or not.
   
   Anyway... instead, we want to wait for the TM failover goes through before 
checking the rescale history. That happens when the job is up and running again 
with parallelism 2 (i.e. one TM with 2 slots is available).
   
   WDYT?



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

Reply via email to