pnowojski commented on a change in pull request #10332: 
[FLINK-13905][checkpointing] Separate checkpoint triggering into several 
asynchronous stages
URL: https://github.com/apache/flink/pull/10332#discussion_r363079050
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java
 ##########
 @@ -708,22 +689,33 @@ public void receiveDeclineMessage(DeclineCheckpoint 
message, String taskManagerL
                                return;
                        }
 
-                       checkpoint = pendingCheckpoints.remove(checkpointId);
+                       checkpoint = pendingCheckpoints.get(checkpointId);
 
-                       if (checkpoint != null && !checkpoint.isDiscarded()) {
+                       if (checkpoint != null) {
+                               Preconditions.checkState(
+                                       !checkpoint.isDiscarded(),
+                                       "Received message for discarded but 
non-removed checkpoint " + checkpointId);
                                LOG.info("Decline checkpoint {} by task {} of 
job {} at {}.",
                                        checkpointId,
                                        message.getTaskExecutionId(),
                                        job,
                                        taskManagerLocationInfo);
-                               discardCheckpoint(checkpoint, 
message.getReason(), message.getTaskExecutionId());
-                       }
-                       else if (checkpoint != null) {
-                               // this should not happen
-                               throw new IllegalStateException(
-                                               "Received message for discarded 
but non-removed checkpoint " + checkpointId);
-                       }
-                       else if (LOG.isDebugEnabled()) {
+                               final CheckpointException checkpointException;
+                               if (message.getReason() == null) {
+                                       checkpointException =
+                                               new 
CheckpointException(CheckpointFailureReason.CHECKPOINT_DECLINED);
+                               } else if (message.getReason() instanceof 
CheckpointException) {
+                                       checkpointException = 
(CheckpointException) message.getReason();
+                               } else {
+                                       checkpointException =
+                                               new CheckpointException(
+                                                       
CheckpointFailureReason.JOB_FAILURE, message.getReason());
+                               }
 
 Review comment:
   extract to a helper method?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to