Repository: hadoop Updated Branches: refs/heads/trunk 225569ece -> b6b95ff66
HDFS-6902. FileWriter should be closed in finally block in BlockReceiver#receiveBlock() (Tsuyoshi OZAWA via Colin Patrick McCabe) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/b6b95ff6 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/b6b95ff6 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/b6b95ff6 Branch: refs/heads/trunk Commit: b6b95ff66700e4db1d8d59a31c3048cb10504262 Parents: 225569e Author: Colin Patrick Mccabe <[email protected]> Authored: Wed Aug 27 13:49:31 2014 -0700 Committer: Colin Patrick Mccabe <[email protected]> Committed: Wed Aug 27 13:49:31 2014 -0700 ---------------------------------------------------------------------- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/b6b95ff6/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index f3ecf07..d5797e8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -655,6 +655,9 @@ Release 2.6.0 - UNRELEASED HDFS-6938. Cleanup javac warnings in FSNamesystem (Charles Lamb via wheat9) + HDFS-6902. FileWriter should be closed in finally block in + BlockReceiver#receiveBlock() (Tsuyoshi OZAWA via Colin Patrick McCabe) + Release 2.5.1 - UNRELEASED INCOMPATIBLE CHANGES http://git-wip-us.apache.org/repos/asf/hadoop/blob/b6b95ff6/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java index afa8bbb..bfb2233 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java @@ -825,15 +825,17 @@ class BlockReceiver implements Closeable { LOG.warn("Failed to delete restart meta file: " + restartMeta.getPath()); } + FileWriter out = null; try { - FileWriter out = new FileWriter(restartMeta); + out = new FileWriter(restartMeta); // write out the current time. out.write(Long.toString(Time.now() + restartBudget)); out.flush(); - out.close(); } catch (IOException ioe) { // The worst case is not recovering this RBW replica. // Client will fall back to regular pipeline recovery. + } finally { + IOUtils.cleanup(LOG, out); } try { // Even if the connection is closed after the ack packet is
