Samrat002 commented on code in PR #27921:
URL: https://github.com/apache/flink/pull/27921#discussion_r3135422279


##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/Executing.java:
##########
@@ -182,6 +187,74 @@ public ScheduledFuture<?> scheduleOperation(Runnable 
callback, Duration delay) {
         return context.runIfState(this, callback, delay);
     }
 
+    private static final Duration ACTIVE_CHECKPOINT_RETRY_DELAY = 
Duration.ofSeconds(10);
+
+    @Override
+    public void requestActiveCheckpointTrigger() {
+        if (!activeCheckpointTriggerEnabled) {
+            return;
+        }
+
+        final CheckpointCoordinator checkpointCoordinator =
+                getExecutionGraph().getCheckpointCoordinator();
+
+        if (checkpointCoordinator == null
+                || !checkpointCoordinator.isPeriodicCheckpointingConfigured()) 
{
+            getLogger()
+                    .debug(
+                            "Skipping active checkpoint trigger for rescale: 
checkpointing not configured.");
+            return;
+        }
+
+        if (!parallelismChanged()) {
+            getLogger()
+                    .debug(
+                            "Skipping active checkpoint trigger for rescale: 
parallelism unchanged.");
+            return;
+        }
+
+        if (checkpointCoordinator.getNumberOfPendingCheckpoints() > 0
+                || checkpointCoordinator.isTriggering()) {
+            getLogger()
+                    .debug(
+                            "Skipping active checkpoint trigger for rescale: 
checkpoint already in progress.");
+            return;
+        }
+
+        if (!checkpointCoordinator.isMinPauseBetweenCheckpointsSatisfied()) {
+            getLogger()
+                    .debug(
+                            "Skipping active checkpoint trigger for rescale: 
min pause between checkpoints not satisfied, scheduling retry.");
+            context.runIfState(
+                    this, this::requestActiveCheckpointTrigger, 
ACTIVE_CHECKPOINT_RETRY_DELAY);
+            return;
+        }
+
+        getLogger().info("Actively triggering checkpoint to expedite 
rescaling.");
+        FutureUtils.assertNoException(
+                checkpointCoordinator
+                        .triggerCheckpoint(false)
+                        .handle(
+                                (completedCheckpoint, throwable) -> {
+                                    if (throwable != null) {
+                                        getLogger()
+                                                .warn(
+                                                        "Active checkpoint 
trigger for rescale failed, scheduling retry.",
+                                                        throwable);
+                                        context.runIfState(

Review Comment:
   Good point, removed the retry on failure entirely. Now when the trigger 
fails, we just log a warning and give up. 
   If the checkpoint fails, the periodic checkpoint scheduler will eventually 
trigger one, or the next `DefaultStateTransitionManager.onChange()` call will 
re-invoke `requestActiveCheckpointTrigger()`



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