hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bor...@apache.org
Subject svn commit: r1076389 - in /hadoop/hdfs/branches/HDFS-1052: CHANGES.txt src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java src/java/org/apache/hadoop/hdfs/server/datanode/UpgradeManagerDatanode.java
Date Wed, 02 Mar 2011 21:21:16 GMT
Author: boryas
Date: Wed Mar  2 21:21:15 2011
New Revision: 1076389

URL: http://svn.apache.org/viewvc?rev=1076389&view=rev
Log:
HDFS-1696. HDFS Federation: when build version doesn't match - datanode should wait (keep
connecting) untill NN comes up with the right version

Modified:
    hadoop/hdfs/branches/HDFS-1052/CHANGES.txt
    hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
    hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/UpgradeManagerDatanode.java

Modified: hadoop/hdfs/branches/HDFS-1052/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1052/CHANGES.txt?rev=1076389&r1=1076388&r2=1076389&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1052/CHANGES.txt (original)
+++ hadoop/hdfs/branches/HDFS-1052/CHANGES.txt Wed Mar  2 21:21:15 2011
@@ -126,6 +126,11 @@ Trunk (unreleased changes)
     HDFS-1688. Fix failures in fault injection tests, TestDiskError, 
     TestDatanodeRestart and TestDFSTartupVersions. (suresh)
 
+    HDFS-1696. HDFS Federation: when build version doesn't match - 
+    datanode should wait (keep connecting) untill NN comes up 
+    with the right version (boryas)
+
+
   IMPROVEMENTS
 
     HDFS-1510. Added test-patch.properties required by test-patch.sh (nigel)

Modified: hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java?rev=1076389&r1=1076388&r2=1076389&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
(original)
+++ hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
Wed Mar  2 21:21:15 2011
@@ -686,31 +686,32 @@ public class DataNode extends Configured
       while (shouldRun && shouldServiceRun) {
         try {
           nsInfo = bpNamenode.versionRequest();
-          break;
+          // verify build version
+          String nsVer = nsInfo.getBuildVersion();
+          String stVer = Storage.getBuildVersion();
+          LOG.info("handshake: namespace info = " + nsInfo);
+          
+          if(! nsVer.equals(stVer)) {
+            String errorMsg = "Incompatible build versions: bp = " + blockPoolId + 
+            "namenode BV = " + nsVer + "; datanode BV = " + stVer;
+            LOG.warn(errorMsg);
+            bpNamenode.errorReport( bpRegistration, 
+                DatanodeProtocol.NOTIFY, errorMsg );
+          } else {
+            break;
+          }
         } catch(SocketTimeoutException e) {  // namenode is busy
-          LOG.info("Problem connecting to server: " + nnAddr);
-          try {
-            Thread.sleep(1000);
-          } catch (InterruptedException ie) {}
+          LOG.warn("Problem connecting to server: " + nnAddr);
+        } catch(IOException e ) {  // namenode is not available
+          LOG.warn("Problem connecting to server: " + nnAddr);
         }
-      }
-      LOG.info("handshake: namespace info = " + nsInfo);
-      // TODO:FEDERATION on version mismatch datanode should continue
-      // to retry
-      // verify build version
-      if(! nsInfo.getBuildVersion().equals(Storage.getBuildVersion())) {
-        String errorMsg = "Incompatible build versions: namenode BV = " 
-          + nsInfo.getBuildVersion() + "; datanode BV = "
-          + Storage.getBuildVersion();
-        LOG.fatal(errorMsg);
+        
+        // try again in a second
         try {
-          bpNamenode.errorReport( bpRegistration,
-              DatanodeProtocol.NOTIFY, errorMsg );
-        } catch( SocketTimeoutException e ) {  // namenode is busy
-          LOG.info("Problem connecting to server: " + nnAddr);
-        }
-        throw new IOException( errorMsg );
+          Thread.sleep(5000);
+        } catch (InterruptedException ie) {}
       }
+      
       assert FSConstants.LAYOUT_VERSION == nsInfo.getLayoutVersion() :
         "Data-node and name-node layout versions must be the same."
         + "Expected: "+ FSConstants.LAYOUT_VERSION 
@@ -980,7 +981,6 @@ public class DataNode extends Configured
             // -- Bytes remaining
             //
             lastHeartbeat = startTime;
-            // TODO:FEDERATION include some global DN stats..
             DatanodeCommand[] cmds = sendHeartBeat();
             myMetrics.heartbeats.inc(now() - startTime);
             if (!processCommand(cmds))
@@ -1307,7 +1307,7 @@ public class DataNode extends Configured
     registerMXBean();
     initDataXceiver(conf);
     startInfoServer(conf);
-    initIpcServer(conf); // TODO:FEDERATION redirect the call appropriately 
+    initIpcServer(conf);
 
     myMetrics = new DataNodeMetrics(conf, datanodeId.getName());
 

Modified: hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/UpgradeManagerDatanode.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/UpgradeManagerDatanode.java?rev=1076389&r1=1076388&r2=1076389&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/UpgradeManagerDatanode.java
(original)
+++ hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/UpgradeManagerDatanode.java
Wed Mar  2 21:21:15 2011
@@ -138,7 +138,6 @@ class UpgradeManagerDatanode extends Upg
     upgradeState = false;
     currentUpgrades = null;
     upgradeDaemon = null;
-    // TODO:FEDERATION what dnRegistration we want to use here?
     DataNode.LOG.info("\n   Distributed upgrade for DataNode " 
         + dataNode.getMachineName()
         + " version " + getUpgradeVersion() + " to current LV " 



Mime
View raw message