1996fanrui commented on code in PR #27441:
URL: https://github.com/apache/flink/pull/27441#discussion_r2712921226
##########
tools/maven/checkstyle.xml:
##########
@@ -61,7 +61,7 @@ This file is based on the checkstyle file of Apache Beam.
-->
<module name="FileLength">
- <property name="max" value="3100"/>
+ <property name="max" value="4000"/>
Review Comment:
It does not seem a good idea. Generally, it is the time to refactor or
something like this when reaching this limitation.
##########
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorDeActivator.java:
##########
@@ -18,35 +18,33 @@
package org.apache.flink.runtime.checkpoint;
-import org.apache.flink.api.common.JobID;
import org.apache.flink.api.common.JobStatus;
+import org.apache.flink.runtime.execution.ExecutionState;
+import org.apache.flink.runtime.executiongraph.ExecutionAttemptID;
+import org.apache.flink.runtime.executiongraph.ExecutionStateUpdateListener;
import org.apache.flink.runtime.executiongraph.JobStatusListener;
-import static org.apache.flink.util.Preconditions.checkNotNull;
-
/**
* This actor listens to changes in the JobStatus and activates or deactivates
the periodic
* checkpoint scheduler.
*/
-public class CheckpointCoordinatorDeActivator implements JobStatusListener {
-
- private final CheckpointCoordinator coordinator;
- private final boolean allTasksOutputNonBlocking;
+public interface CheckpointCoordinatorDeActivator
+ extends JobStatusListener, ExecutionStateUpdateListener {
- public CheckpointCoordinatorDeActivator(
+ static CheckpointCoordinatorDeActivator forJobStatus(
CheckpointCoordinator coordinator, boolean
allTasksOutputNonBlocking) {
- this.coordinator = checkNotNull(coordinator);
- this.allTasksOutputNonBlocking = allTasksOutputNonBlocking;
+ return (jobId, newJobStatus, timestamp) -> {
+ if (newJobStatus == JobStatus.RUNNING &&
allTasksOutputNonBlocking) {
+ // start the checkpoint scheduler if there is no blocking edge
+ coordinator.startCheckpointScheduler();
+ } else {
+ // anything else should stop the trigger for now
+ coordinator.stopCheckpointScheduler();
+ }
Review Comment:
`forJobStatus` is only called once, and `allTasksOutputNonBlocking` is
false. so `forJobStatus` can be simplified.
--
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]