masteryhx commented on a change in pull request #18224:
URL: https://github.com/apache/flink/pull/18224#discussion_r818474731



##########
File path: flink-tests/src/test/java/org/apache/flink/test/util/TestUtils.java
##########
@@ -94,6 +102,59 @@ public static void waitUntilJobInitializationFinished(
                 userCodeClassloader);
     }
 
+    public static CheckpointMetadata loadCheckpointMetadata(String 
savepointPath)
+            throws IOException {
+        CompletedCheckpointStorageLocation location =
+                
AbstractFsCheckpointStorageAccess.resolveCheckpointPointer(savepointPath);
+
+        try (DataInputStream stream =
+                new 
DataInputStream(location.getMetadataHandle().openInputStream())) {
+            return Checkpoints.loadCheckpointMetadata(
+                    stream, Thread.currentThread().getContextClassLoader(), 
savepointPath);
+        }
+    }
+
+    public static List<Path> findAllSortedExternalizedCheckpoint(File 
checkpointDir, JobID jobId)
+            throws IOException {
+        return findAllExternalizedCheckpoint(checkpointDir, jobId).stream()
+                .sorted(
+                        Comparator.comparingInt(
+                                path ->
+                                        Integer.parseInt(
+                                                path.getFileName()
+                                                        .toString()
+                                                        .substring(
+                                                                
CHECKPOINT_DIR_PREFIX.length()))))
+                .collect(Collectors.toList());
+    }
+
+    public static Optional<Path> findExternalizedCheckpoint(File 
checkpointDir, JobID jobId)

Review comment:
       Have replaced `findExternalizedCheckpoint` with 
`getMostRecentCompletedCheckpointMaybe`




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


Reply via email to