alexeykudinkin commented on code in PR #6830:
URL: https://github.com/apache/hudi/pull/6830#discussion_r1086202983
##########
hudi-common/src/test/java/org/apache/hudi/common/functional/TestHoodieLogFormat.java:
##########
@@ -914,6 +917,34 @@ public void testAppendAndReadOnCorruptedLog() throws
IOException, URISyntaxExcep
reader.close();
}
+ @Test
+ public void testSkipCorruptedCheck() throws Exception {
+ // normal case: if the block is corrupted, we should be able to read back
a corrupted block
+ Reader reader1 = createCorruptedFile("test-fileid1");
+ HoodieLogBlock block = reader1.next();
+ assertEquals(HoodieLogBlockType.CORRUPT_BLOCK, block.getBlockType(), "The
read block should be a corrupt block");
+ reader1.close();
+
+ // as we can't mock a private method or directly test it, we are going
this route.
+ // So adding a corrupted block which ideally should have been skipped for
write transactional system. and hence when we call next() on log block reader,
it will fail.
+ Reader reader2 = createCorruptedFile("test-fileid2");
+ assertTrue(reader2.hasNext(), "We should have corrupted block next");
+
+ // mock the fs to be GCS to skip isBlockCorrupted() check
+ Field f1 = reader2.getClass().getDeclaredField("fs");
Review Comment:
We should rewrite this PR to use custom (mocked) FS w/ custom scheme, so
that we don't need to call setAccessible (which is deprecated in JDK 17)
--
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]