akalash commented on code in PR #21440:
URL: https://github.com/apache/flink/pull/21440#discussion_r1038238028


##########
flink-tests/src/test/java/org/apache/flink/test/checkpointing/UnalignedCheckpointStressITCase.java:
##########
@@ -559,4 +551,30 @@ public Record map(Record value) throws Exception {
             return value.validate();
         }
     }
+
+    /**
+     * The file visitor which is looking for the most recent checkpoint.
+     */
+    private static class MaxCheckpointFileVisitor extends 
SimpleFileVisitor<Path> {
+        private Path maxCheckpointDir;
+
+        @Override
+        public FileVisitResult visitFile(Path path, BasicFileAttributes 
basicFileAttributes) {
+            if (path.endsWith("_metadata")) {
+                int curCheckpointId = 
getCheckpointNumberFromPath(path.getParent());
+                int prevCheckpointId =
+                        maxCheckpointDir == null
+                                ? -1
+                                : 
getCheckpointNumberFromPath(maxCheckpointDir);
+                if (prevCheckpointId < curCheckpointId) {
+                    maxCheckpointDir = path.getParent();
+                }
+            }
+            return FileVisitResult.CONTINUE;
+        }
+
+        public Path getMaxCheckpointDir() {
+            return maxCheckpointDir;
+        }
+    }

Review Comment:
   I have added `visitFileFailed` and now I think it should be enough



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