HDFS-11229. HDFS-11056 failed to close meta file. Contributed by Wei-Chiu Chuang.

This commit is contained in:
Wei-Chiu Chuang 2016-12-09 16:02:42 -08:00
parent b606e025f1
commit 2a28e8cf04

View File

@ -1132,9 +1132,10 @@ private byte[] loadLastPartialChunkChecksum(
int offsetInChecksum = BlockMetadataHeader.getHeaderSize() +
(int)(onDiskLen / bytesPerChecksum * checksumSize);
byte[] lastChecksum = new byte[checksumSize];
RandomAccessFile raf = new RandomAccessFile(metaFile, "r");
try (RandomAccessFile raf = new RandomAccessFile(metaFile, "r")) {
raf.seek(offsetInChecksum);
raf.read(lastChecksum, 0, checksumSize);
}
return lastChecksum;
}