Repository: hadoop Updated Branches: refs/heads/branch-2 6c93c1870 -> 292bd78b4
HDFS-11229. HDFS-11056 failed to close meta file. Contributed by Wei-Chiu Chuang. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/292bd78b Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/292bd78b Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/292bd78b Branch: refs/heads/branch-2 Commit: 292bd78b4494ba1a1073b32b3f89d95e72f3204d Parents: 6c93c18 Author: Wei-Chiu Chuang <weic...@apache.org> Authored: Fri Dec 9 16:07:56 2016 -0800 Committer: Wei-Chiu Chuang <weic...@apache.org> Committed: Fri Dec 9 16:07:56 2016 -0800 ---------------------------------------------------------------------- .../hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/292bd78b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java ---------------------------------------------------------------------- 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 7abccb9..216b934 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 @@ -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"); - 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; } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org