diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index b962fce30b4..f8fe1e51aaa 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -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 diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java index 4ad863ee787..2b121ac483b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java @@ -1097,9 +1097,10 @@ class FsDatasetImpl implements FsDatasetSpi { int offsetInChecksum = BlockMetadataHeader.getHeaderSize() + (int)(onDiskLen / bytesPerChecksum * checksumSize); byte[] lastChecksum = new byte[checksumSize]; - RandomAccessFile raf = new RandomAccessFile(metaFile, "r"); - raf.seek(offsetInChecksum); - raf.read(lastChecksum, 0, checksumSize); + try (RandomAccessFile raf = new RandomAccessFile(metaFile, "r")) { + raf.seek(offsetInChecksum); + raf.read(lastChecksum, 0, checksumSize); + } return lastChecksum; }