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:07:56 -08:00
parent 6c93c1870c
commit 292bd78b44
1 changed files with 4 additions and 3 deletions

View File

@ -1188,9 +1188,10 @@ class FsDatasetImpl implements FsDatasetSpi<FsVolumeImpl> {
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;
}