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 ca60487ecc9..3c751520d7b 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) 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 c9301877b8d..5e2a534ed78 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"); + } } /**