浏览代码

HDFS-12378. TestClientProtocolForPipelineRecovery#testZeroByteBlockRecovery fails on trunk. (Lei (Eddy) Xu)

Lei Xu 7 年之前
父节点
当前提交
e140489147

+ 10 - 2
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java

@@ -3000,8 +3000,16 @@ public class DataNode extends ReconfigurableBase
     b.setNumBytes(visible);
     b.setNumBytes(visible);
 
 
     if (targets.length > 0) {
     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);
+      }
     }
     }
   }
   }