diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index facfc2fde6..e8af487aa6 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -31,6 +31,10 @@ Trunk (unreleased changes) HDFS-2337. DFSClient shouldn't keep multiple RPC proxy references (atm) + HDFS-362. FSEditLog should not writes long and short as UTF8, and should + not use ArrayWritable for writing non-array items. (Uma Maheswara Rao G + via szetszwo) + BUG FIXES HDFS-2287. TestParallelRead has a small off-by-one bug. (todd) @@ -49,9 +53,9 @@ Trunk (unreleased changes) HDFS-2333. Change DFSOutputStream back to package private, otherwise, there are two SC_START_IN_CTOR findbugs warnings. (szetszwo) - HDFS-362. FSEditLog should not writes long and short as UTF8, and should - not use ArrayWritable for writing non-array items. (Uma Maheswara Rao G - via szetszwo) + HDFS-2330. In NNStorage and FSImagePreTransactionalStorageInspector, + IOExceptions of stream closures can mask root exceptions. (Uma Maheswara + Rao G via szetszwo) Release 0.23.0 - Unreleased diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImagePreTransactionalStorageInspector.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImagePreTransactionalStorageInspector.java index 91076ef5f6..4b0fd27641 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImagePreTransactionalStorageInspector.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImagePreTransactionalStorageInspector.java @@ -36,6 +36,7 @@ import org.apache.hadoop.hdfs.server.common.Storage.StorageDirectory; import org.apache.hadoop.hdfs.server.namenode.NNStorage.NameNodeDirType; import org.apache.hadoop.hdfs.server.namenode.NNStorage.NameNodeFile; +import org.apache.hadoop.io.IOUtils; /** * Inspects a FSImage storage directory in the "old" (pre-HDFS-1073) format. @@ -130,8 +131,10 @@ static long readCheckpointTime(StorageDirectory sd) throws IOException { DataInputStream in = new DataInputStream(new FileInputStream(timeFile)); try { timeStamp = in.readLong(); - } finally { in.close(); + in = null; + } finally { + IOUtils.cleanup(LOG, in); } } return timeStamp; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java index 869922abb2..82096252ac 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java @@ -173,10 +173,12 @@ public boolean isPreUpgradableLayout(StorageDirectory sd) throws IOException { try { oldFile.seek(0); int oldVersion = oldFile.readInt(); + oldFile.close(); + oldFile = null; if (oldVersion < LAST_PRE_UPGRADE_LAYOUT_VERSION) return false; } finally { - oldFile.close(); + IOUtils.cleanup(LOG, oldFile); } return true; } @@ -392,6 +394,8 @@ static long readTransactionIdFile(StorageDirectory sd) throws IOException { BufferedReader br = new BufferedReader(new FileReader(txidFile)); try { txid = Long.valueOf(br.readLine()); + br.close(); + br = null; } finally { IOUtils.cleanup(LOG, br); } @@ -413,6 +417,8 @@ void writeTransactionIdFile(StorageDirectory sd, long txid) throws IOException { try { fos.write(String.valueOf(txid).getBytes()); fos.write('\n'); + fos.close(); + fos = null; } finally { IOUtils.cleanup(LOG, fos); }