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

(cherry picked from commit 292bd78b44)
(cherry picked from commit fa3b2bee61)
This commit is contained in:
Wei-Chiu Chuang 2016-12-10 09:34:05 -08:00
parent deae1f8323
commit 2123b664ca
2 changed files with 6 additions and 3 deletions

View File

@ -205,6 +205,8 @@ Release 2.7.4 - UNRELEASED
HDFS-11180. Intermittent deadlock in NameNode when failover happens.
(aajisaka)
HDFS-11229. HDFS-11056 failed to close meta file. (Wei-Chiu Chuang)
Release 2.7.3 - 2016-08-25
INCOMPATIBLE CHANGES

View File

@ -1097,9 +1097,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;
}