ifndef-SleePy 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_r366664152
##########
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:
Ah, I forgot to leave an explanation about this. I didn't squash the
original commits to make it easy to continue reviewing.
Actually I have extracted the "else if ... else" to a helper method named
`getCheckpointException`. But it does happen in fixup commit but in the
original commit "[FLINK-13905][checkpointing] Separate checkpoint triggering
into several asynchronous stages.". I thought it's enough as a helper method.
And thanks for the reminding to keep per fixup as a separate commit. I'll
try to separate the last big fixup commit :)
----------------------------------------------------------------
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