You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by vb...@apache.org on 2020/05/07 20:05:41 UTC

[incubator-hudi] branch master updated: [HUDI-784] Adressing issue with log reader on GCS (#1516)

This is an automated email from the ASF dual-hosted git repository.

vbalaji pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hudi.git


The following commit(s) were added to refs/heads/master by this push:
     new e783ab1  [HUDI-784] Adressing issue with log reader on GCS (#1516)
e783ab1 is described below

commit e783ab174946a0b767396239c0132c31c8d26458
Author: Alexander Filipchik <af...@gmail.com>
AuthorDate: Thu May 7 13:05:32 2020 -0700

    [HUDI-784] Adressing issue with log reader on GCS (#1516)
    
    [HUDI-784] Adressing issue with log reader on GCS (#1516)
    Co-authored-by: Alex Filipchik <al...@csscompany.com>
---
 .../org/apache/hudi/common/table/log/HoodieLogFileReader.java     | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hudi-common/src/main/java/org/apache/hudi/common/table/log/HoodieLogFileReader.java b/hudi-common/src/main/java/org/apache/hudi/common/table/log/HoodieLogFileReader.java
index ff44c50..da3a375 100644
--- a/hudi-common/src/main/java/org/apache/hudi/common/table/log/HoodieLogFileReader.java
+++ b/hudi-common/src/main/java/org/apache/hudi/common/table/log/HoodieLogFileReader.java
@@ -59,7 +59,7 @@ class HoodieLogFileReader implements HoodieLogFormat.Reader {
 
   private final FSDataInputStream inputStream;
   private final HoodieLogFile logFile;
-  private static final byte[] MAGIC_BUFFER = new byte[6];
+  private final byte[] magicBuffer = new byte[6];
   private final Schema readerSchema;
   private boolean readBlockLazily;
   private long reverseLogFilePosition;
@@ -245,7 +245,7 @@ class HoodieLogFileReader implements HoodieLogFormat.Reader {
     inputStream.seek(inputStream.getPos() - Long.BYTES);
     // Block size in the footer includes the magic header, which the header does not include.
     // So we have to shorten the footer block size by the size of magic hash
-    long blockSizeFromFooter = inputStream.readLong() - MAGIC_BUFFER.length;
+    long blockSizeFromFooter = inputStream.readLong() - magicBuffer.length;
     if (blocksize != blockSizeFromFooter) {
       LOG.info("Found corrupted block in file " + logFile + ". Header block size(" + blocksize
               + ") did not match the footer block size(" + blockSizeFromFooter + ")");
@@ -325,8 +325,8 @@ class HoodieLogFileReader implements HoodieLogFormat.Reader {
 
   private boolean hasNextMagic() throws IOException {
     // 1. Read magic header from the start of the block
-    inputStream.readFully(MAGIC_BUFFER, 0, 6);
-    return Arrays.equals(MAGIC_BUFFER, HoodieLogFormat.MAGIC);
+    inputStream.readFully(magicBuffer, 0, 6);
+    return Arrays.equals(magicBuffer, HoodieLogFormat.MAGIC);
   }
 
   @Override