Repository: hadoop Updated Branches: refs/heads/branch-2 fdc15db2e -> 01b2c9b15
HDFS-6902. FileWriter should be closed in finally block in BlockReceiver#receiveBlock() (Tsuyoshi OZAWA via Colin Patrick McCabe) (cherry picked from commit b6b95ff66700e4db1d8d59a31c3048cb10504262) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/01b2c9b1 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/01b2c9b1 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/01b2c9b1 Branch: refs/heads/branch-2 Commit: 01b2c9b15f812872f2797aec0fe38cc2e1e488fe Parents: fdc15db 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:51:10 2014 -0700 ---------------------------------------------------------------------- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 5 +++++ .../org/apache/hadoop/hdfs/server/datanode/BlockReceiver.java | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/01b2c9b1/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 9b29cb7..4d3d07e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -301,6 +301,11 @@ Release 2.6.0 - UNRELEASED HDFS-6892. Add XDR packaging method for each NFS request (brandonli) + 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/01b2c9b1/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
