sadanand48 commented on code in PR #9784:
URL: https://github.com/apache/ozone/pull/9784#discussion_r2852321758
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMDbCheckpointServletInodeBasedXfer.java:
##########
@@ -852,6 +852,44 @@ public void
testCheckpointIncludesSnapshotsFromFrozenState() throws Exception {
}
}
+
+ /**
+ * Verifies that when a file is deleted before/during transfer, the servlet
+ * gracefully skips it without failing (handles NoSuchFileException).
+ */
+ @Test
+ public void testCollectFilesFromDirSkipsDeletedFile() throws Exception {
+ OMDBCheckpointServletInodeBasedXfer servlet = new
OMDBCheckpointServletInodeBasedXfer();
+ Path dbDir = Files.createTempDirectory(folder, "dbdir-");
+ Path sstFile1 = dbDir.resolve("file1.sst");
+ Path sstFile2 = dbDir.resolve("file2.sst");
+ Path sstFile3 = dbDir.resolve("file3.sst");
+ Files.write(sstFile1, "content1".getBytes(StandardCharsets.UTF_8));
+ Files.write(sstFile2, "content2".getBytes(StandardCharsets.UTF_8));
+ Files.write(sstFile3, "content3".getBytes(StandardCharsets.UTF_8));
+
+ // Delete file2 before transfer , same as pruner
+ Files.delete(sstFile2);
+ OMDBArchiver archiver = new OMDBArchiver();
+ Path tmpDir = folder.resolve("tmp-deleted-file-test");
+ Files.createDirectories(tmpDir);
+ archiver.setTmpDir(tmpDir);
+ OMDBArchiver archiverSpy = spy(archiver);
+
+ Set<String> sstFilesToExclude = new HashSet<>();
+ AtomicLong maxTotalSstSize = new AtomicLong(Long.MAX_VALUE);
+
+ doAnswer(invocation -> archiver.recordFileEntry(
+ invocation.getArgument(0), invocation.getArgument(1)))
+ .when(archiverSpy).recordFileEntry(any(), anyString());
+
+ boolean result = servlet.collectFilesFromDir(sstFilesToExclude, dbDir,
Review Comment:
Done.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]