瀏覽代碼

HADOOP-285. Fix DFS datanodes to be able to re-join the cluster after the connection to the namenode is lost. Contributed by Owen.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@412494 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 19 年之前
父節點
當前提交
c08324049e
共有 2 個文件被更改,包括 16 次插入9 次删除
  1. 3 0
      CHANGES.txt
  2. 13 9
      src/java/org/apache/hadoop/dfs/DataNode.java

+ 3 - 0
CHANGES.txt

@@ -17,6 +17,9 @@ Trunk (unreleased changes)
  4. HADOOP-240.  DFS's mkdirs() implementation no longer logs a warning
  4. HADOOP-240.  DFS's mkdirs() implementation no longer logs a warning
     when the directory already exists. (Hairong Kuang via cutting)
     when the directory already exists. (Hairong Kuang via cutting)
 
 
+ 5. HADOOP-285.  Fix DFS datanodes to be able to re-join the cluster
+    after the connection to the namenode is lost.  (omalley via cutting)
+
 
 
 Release 0.3.1 - 2006-06-05
 Release 0.3.1 - 2006-06-05
 
 

+ 13 - 9
src/java/org/apache/hadoop/dfs/DataNode.java

@@ -208,9 +208,7 @@ public class DataNode implements FSConstants, Runnable {
      * forever calling remote NameNode functions.
      * forever calling remote NameNode functions.
      */
      */
     public void offerService() throws Exception {
     public void offerService() throws Exception {
-      // start dataXceiveServer  
-      dataXceiveServer.start();
-      
+     
       long lastHeartbeat = 0, lastBlockReport = 0;
       long lastHeartbeat = 0, lastBlockReport = 0;
       LOG.info("using BLOCKREPORT_INTERVAL of " + blockReportInterval + "msec");
       LOG.info("using BLOCKREPORT_INTERVAL of " + blockReportInterval + "msec");
 
 
@@ -328,11 +326,6 @@ public class DataNode implements FSConstants, Runnable {
         handleDiskError(e.getMessage());
         handleDiskError(e.getMessage());
       }
       }
       
       
-      // wait for dataXceiveServer to terminate
-      try {
-          this.dataXceiveServer.join();
-      } catch (InterruptedException ie) {
-      }
     } // offerService
     } // offerService
 
 
     /**
     /**
@@ -818,6 +811,10 @@ public class DataNode implements FSConstants, Runnable {
      */
      */
     public void run() {
     public void run() {
         LOG.info("Starting DataNode in: "+data.data);
         LOG.info("Starting DataNode in: "+data.data);
+        
+        // start dataXceiveServer
+        dataXceiveServer.start();
+        
         while (shouldRun) {
         while (shouldRun) {
             try {
             try {
                 offerService();
                 offerService();
@@ -832,7 +829,14 @@ public class DataNode implements FSConstants, Runnable {
               }
               }
             }
             }
         }
         }
-      LOG.info("Finishing DataNode in: "+data.data);
+        
+        // wait for dataXceiveServer to terminate
+        try {
+            this.dataXceiveServer.join();
+        } catch (InterruptedException ie) {
+        }
+        
+        LOG.info("Finishing DataNode in: "+data.data);
     }
     }
 
 
     /** Start datanode daemons.
     /** Start datanode daemons.