5herhom commented on code in PR #6031:
URL: https://github.com/apache/hudi/pull/6031#discussion_r917356547


##########
hudi-common/src/main/java/org/apache/hudi/common/table/log/HoodieLogFileReader.java:
##########
@@ -285,6 +288,22 @@ private boolean isBlockCorrupted(int blocksize) throws 
IOException {
       // release-3.1.0-RC1/BufferedFSInputStream.java#L73
       inputStream.seek(currentPos);
       return true;
+    } catch (IOException e) {
+      if (logFile.getFileSize() < 0) {
+        long logFileSize = FSUtils.getFileSize(fs, logFile.getPath());
+        logFile.setFileLen(logFileSize);
+      }
+      if (endOfBlockPos > logFile.getFileSize() || endOfBlockPos < 0) {
+        LOG.info("Found corrupted block in file " + logFile + " with block 
size(" + blocksize + ") running past EOF");
+        // this is corrupt
+        // This seek is required because contract of seek() is different for 
naked DFSInputStream vs BufferedFSInputStream
+        // release-3.1.0-RC1/DFSInputStream.java#L1455
+        // release-3.1.0-RC1/BufferedFSInputStream.java#L73
+        inputStream.seek(currentPos);
+        return true;
+      } else {
+        throw e;
+      }

Review Comment:
   New commit have covered to the old according to your suggestion. Please 
review again. Thank you~



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