HDFS-8183. Erasure Coding: Improve DFSStripedOutputStream closing of datastreamer threads. Contributed by Rakesh R.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/63de26f9 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/63de26f9 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/63de26f9 Branch: refs/heads/HDFS-7285 Commit: 63de26f925f748d0866335a36721fd4e8bb8776e Parents: 40d5a85 Author: Zhe Zhang <z...@apache.org> Authored: Thu Apr 30 00:13:32 2015 -0700 Committer: Jing Zhao <ji...@apache.org> Committed: Mon May 18 22:11:07 2015 -0700 ---------------------------------------------------------------------- .../hadoop-hdfs/CHANGES-HDFS-EC-7285.txt | 3 +++ .../org/apache/hadoop/hdfs/DFSStripedOutputStream.java | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/63de26f9/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt index ca60487..3c75152 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt @@ -149,3 +149,6 @@ HDFS-8282. Erasure coding: move striped reading logic to StripedBlockUtil. (Zhe Zhang) + + HDFS-8183. Erasure Coding: Improve DFSStripedOutputStream closing of + datastreamer threads. (Rakesh R via Zhe Zhang) http://git-wip-us.apache.org/repos/asf/hadoop/blob/63de26f9/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSStripedOutputStream.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSStripedOutputStream.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSStripedOutputStream.java index c930187..5e2a534 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSStripedOutputStream.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSStripedOutputStream.java @@ -331,18 +331,26 @@ public class DFSStripedOutputStream extends DFSOutputStream { // interrupt datastreamer if force is true @Override protected void closeThreads(boolean force) throws IOException { + int index = 0; + boolean exceptionOccurred = false; for (StripedDataStreamer streamer : streamers) { try { streamer.close(force); streamer.join(); streamer.closeSocket(); - } catch (InterruptedException e) { - throw new IOException("Failed to shutdown streamer"); + } catch (InterruptedException | IOException e) { + DFSClient.LOG.error("Failed to shutdown streamer: name=" + + streamer.getName() + ", index=" + index + ", file=" + src, e); + exceptionOccurred = true; } finally { streamer.setSocketToNull(); setClosed(); + index++; } } + if (exceptionOccurred) { + throw new IOException("Failed to shutdown streamer"); + } } /**