pnowojski commented on code in PR #21440:
URL: https://github.com/apache/flink/pull/21440#discussion_r1037895413
##########
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:
This answer: https://stackoverflow.com/a/72865899/8149051
suggests that this might be not enough? 🤔 However I remember using the
visitor exactly the way you were using to solve the same problem, so I'm not
sure if the answer is correct.
--
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]