hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dhr...@apache.org
Subject svn commit: r1054544 - in /hadoop/hdfs/trunk: CHANGES.txt src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
Date Mon, 03 Jan 2011 07:51:14 GMT
Author: dhruba
Date: Mon Jan  3 07:51:14 2011
New Revision: 1054544

URL: http://svn.apache.org/viewvc?rev=1054544&view=rev
Log:
HDFS-1540. Make Datanode handle errors from RPC calls to namenode
more elegantly. (dhruba)


Modified:
    hadoop/hdfs/trunk/CHANGES.txt
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java

Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=1054544&r1=1054543&r2=1054544&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Mon Jan  3 07:51:14 2011
@@ -51,6 +51,9 @@ Trunk (unreleased changes)
     HDFS-1509. A savenamespace command writes the fsimage and edits into
     all configured directories. (dhruba)
 
+    HDFS-1540. Make Datanode handle errors from RPC calls to namenode
+    more elegantly. (dhruba)
+
 Release 0.22.0 - Unreleased
 
   NEW FEATURES

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java?rev=1054544&r1=1054543&r2=1054544&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java Mon Jan
 3 07:51:14 2011
@@ -548,12 +548,12 @@ public class DataNode extends Configured
       try {
         nsInfo = namenode.versionRequest();
         break;
-      } catch(SocketTimeoutException e) {  // namenode is busy
-        LOG.info("Problem connecting to server: " + getNameNodeAddr());
-        try {
-          Thread.sleep(1000);
-        } catch (InterruptedException ie) {}
+      } catch(IOException e) {  // namenode cannot be contacted
+        LOG.info("Problem connecting to server: " + getNameNodeAddr(), e);
       }
+      try {
+        Thread.sleep(1000);
+      } catch (InterruptedException ie) {}
     }
     String errorMsg = null;
     // verify build version
@@ -683,12 +683,21 @@ public class DataNode extends Configured
         dnRegistration.name = machineName + ":" + dnRegistration.getPort();
         dnRegistration = namenode.registerDatanode(dnRegistration);
         break;
-      } catch(SocketTimeoutException e) {  // namenode is busy
-        LOG.info("Problem connecting to server: " + getNameNodeAddr());
-        try {
-          Thread.sleep(1000);
-        } catch (InterruptedException ie) {}
+      } catch(RemoteException re) {
+        IOException ue = re.unwrapRemoteException(
+                           UnregisteredNodeException.class,
+                           DisallowedDatanodeException.class,
+                           IncorrectVersionException.class);
+        if (ue != re) {
+          LOG.warn("DataNode is shutting down: ", re);
+          throw ue; 
+        }
+      } catch(IOException e) {  // namenode cannot be contacted
+        LOG.info("Problem connecting to server: " + getNameNodeAddr(), e);
       }
+      try {
+        Thread.sleep(1000);
+      } catch (InterruptedException ie) {}
     }
     assert ("".equals(storage.getStorageID()) 
             && !"".equals(dnRegistration.getStorageID()))



Mime
View raw message