tillrohrmann commented on a change in pull request #7118: [FLINK-10482] Fix 
double counting of checkpoint stat
URL: https://github.com/apache/flink/pull/7118#discussion_r238715678
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java
 ##########
 @@ -1195,11 +1196,16 @@ public void stopCheckpointScheduler() {
                                currentPeriodicTrigger = null;
                        }
 
-                       for (PendingCheckpoint p : pendingCheckpoints.values()) 
{
+                       // take a snapshot of pendingCheckpoints to clear them 
and prevent aborting them twice
+                       // in case of subsequent call of 
stopCheckpointScheduler()
+                       List<PendingCheckpoint> pendingCheckpointsSnapshot =
+                               new ArrayList<>(pendingCheckpoints.values());
+                       pendingCheckpoints.clear();
+
+                       for (PendingCheckpoint p : pendingCheckpointsSnapshot) {
 
 Review comment:
   Just as a note, I guess we could have solved the problem also by changing 
`JobMaster.java:965-975` into a `handleAsync` part because the problem seems to 
be that by aborting a `PendingCheckpoint` we fail the savepoint future which is 
then directly triggers the execution of the `exceptionally` handler. By 
decoupling the `exceptionally` handler from the `stopCheckpointScheduler` call, 
there should not be any concurrency problem.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to