.../main/java/org/apache/hadoop/hbase/io/hfile/ChecksumUtil.java | 6 +++--- .../src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlock.java | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/ChecksumUtil.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/ChecksumUtil.java index 61862eb..9bcd943 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/ChecksumUtil.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/ChecksumUtil.java @@ -87,7 +87,7 @@ public class ChecksumUtil { * The header is extracted from the specified HFileBlock while the * data-to-be-verified is extracted from 'data'. */ - static boolean validateBlockChecksum(Path path, HFileBlock block, + static boolean validateBlockChecksum(String pathName, HFileBlock block, byte[] data, int hdrSize) throws IOException { // If this is an older version of the block that does not have @@ -120,14 +120,14 @@ public class ChecksumUtil { LOG.info("length of data = " + data.length + " OnDiskDataSizeWithHeader = " + sizeWithHeader + " checksum type = " + cktype.getName() - + " file =" + path.toString() + + " file =" + pathName + " header size = " + hdrSize + " bytesPerChecksum = " + bytesPerChecksum); } try { dataChecksum.verifyChunkedSums(ByteBuffer.wrap(data, 0, sizeWithHeader), ByteBuffer.wrap(data, sizeWithHeader, data.length - sizeWithHeader), - path.toString(), 0); + pathName, 0); } catch (ChecksumException e) { return false; } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlock.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlock.java index 0a25825..e090c12 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlock.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlock.java @@ -1362,12 +1362,15 @@ public class HFileBlock implements Cacheable { public static final int DEFAULT_BUFFER_SIZE = 1 << 20; protected HFileContext fileContext; + // Cache the fileName + protected String pathName; public FSReaderImpl(FSDataInputStreamWrapper stream, long fileSize, HFileSystem hfs, Path path, HFileContext fileContext) throws IOException { this.fileSize = fileSize; this.hfs = hfs; this.path = path; + this.pathName = path.toString(); this.fileContext = fileContext; this.hdrSize = headerSize(fileContext.isUseHBaseChecksum()); @@ -1744,7 +1747,7 @@ public class HFileBlock implements Cacheable { */ protected boolean validateBlockChecksum(HFileBlock block, byte[] data, int hdrSize) throws IOException { - return ChecksumUtil.validateBlockChecksum(path, block, data, hdrSize); + return ChecksumUtil.validateBlockChecksum(pathName, block, data, hdrSize); } @Override