You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "codope (via GitHub)" <gi...@apache.org> on 2023/01/25 05:15:29 UTC
[GitHub] [hudi] codope commented on a diff in pull request #6830: [HUDI-2118] Skip checking corrupt log blocks for transactional write file systems
codope commented on code in PR #6830:
URL: https://github.com/apache/hudi/pull/6830#discussion_r1086212761
##########
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:
+1 HUDI-5614 for followup.
cc @giftbowen
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org