1u0 commented on a change in pull request #9727: [FLINK-14145] Fix 
getLatestCheckpoint(true) returns wrong checkpoint
URL: https://github.com/apache/flink/pull/9727#discussion_r326561727
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CompletedCheckpointStore.java
 ##########
 @@ -60,6 +60,10 @@ default CompletedCheckpoint getLatestCheckpoint(boolean 
isPreferCheckpointForRec
                }
 
                CompletedCheckpoint candidate = 
getAllCheckpoints().get(getAllCheckpoints().size() - 1);
+               if (!candidate.getProperties().isSavepoint()) {
+                       return candidate;
+               }
 
 Review comment:
   This `if` check can be moved into the next `if` block. This would be more 
explicit that this check is specific only for `isPreferCheckpointForRecovery = 
true` and has no effect otherwise.
   
   Additional suggestion: although it's not relevant to your PR and the changes 
in the ticket, you can assign a variable for `getAllCheckpoints()`  once in the 
top of the method. This would avoid additional method calls, array copies and 
should make this method more clearer. 

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