diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java index 837ac078e8..042a6272d4 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java @@ -3000,8 +3000,16 @@ void transferReplicaForPipelineRecovery(final ExtendedBlock b, b.setNumBytes(visible); if (targets.length > 0) { - new Daemon(new DataTransfer(targets, targetStorageTypes, - targetStorageIds, b, stage, client)).start(); + Daemon daemon = new Daemon(threadGroup, + new DataTransfer(targets, targetStorageTypes, targetStorageIds, b, + stage, client)); + daemon.start(); + try { + daemon.join(); + } catch (InterruptedException e) { + throw new IOException( + "Pipeline recovery for " + b + " is interrupted.", e); + } } }