hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r548507 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/dfs/DataNode.java src/java/org/apache/hadoop/dfs/DatanodeRegistration.java src/java/org/apache/hadoop/dfs/NameNode.java src/java/org/apache/hadoop/dfs/Storage.java
Date Mon, 18 Jun 2007 22:05:28 GMT
Author: cutting
Date: Mon Jun 18 15:05:27 2007
New Revision: 548507

URL: http://svn.apache.org/viewvc?view=rev&rev=548507
Log:
HADOOP-1492.  Fix a NullPointerException handling version mismatch during datanode registration.
 Contributed by Konstantin.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DatanodeRegistration.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/NameNode.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/Storage.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=548507&r1=548506&r2=548507
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Mon Jun 18 15:05:27 2007
@@ -169,6 +169,10 @@
      and also substantially improves performance.
      (Arun C Murthy via cutting)
 
+ 53. HADOOP-1492.  Fix a NullPointerException handling version
+     mismatch during datanode registration.
+     (Konstantin Shvachko via cutting)
+
 
 Release 0.13.0 - 2007-06-08
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java?view=diff&rev=548507&r1=548506&r2=548507
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java Mon Jun 18 15:05:27 2007
@@ -212,6 +212,10 @@
                                      conf.get("dfs.datanode.dns.nameserver","default"));
     InetSocketAddress nameNodeAddr = createSocketAddr(
                                                       conf.get("fs.default.name", "local"));
+    int tmpPort = conf.getInt("dfs.datanode.port", 50010);
+    storage = new DataStorage();
+    // construct registration
+    this.dnRegistration = new DatanodeRegistration(machineName + ":" + tmpPort);
 
     // connect to name node
     this.namenode = (DatanodeProtocol) 
@@ -225,15 +229,15 @@
     // read storage info, lock data dirs and transition fs state if necessary
     StartupOption startOpt = getStartupOption(conf);
     assert startOpt != null : "Startup option must be set.";
-    storage = new DataStorage();
     storage.recoverTransitionRead(nsInfo, dataDirs, startOpt);
+    // adjust
+    this.dnRegistration.setStorageInfo(storage);
       
     // initialize data node internal structure
     this.data = new FSDataset(storage, conf);
       
     // find free port
     ServerSocket ss = null;
-    int tmpPort = conf.getInt("dfs.datanode.port", 50010);
     String bindAddress = conf.get("dfs.datanode.bindAddress", "0.0.0.0");
     while (ss == null) {
       try {
@@ -244,11 +248,8 @@
         tmpPort++;
       }
     }
-    // construct registration
-    this.dnRegistration = new DatanodeRegistration(
-                                                   machineName + ":" + tmpPort, 
-                                                   -1,   // info port determined later
-                                                   storage);
+    // adjust machine name with the actual port
+    this.dnRegistration.setName(machineName + ":" + tmpPort);
       
     this.dataXceiveServer = new Daemon(new DataXceiveServer(ss));
 
@@ -265,7 +266,8 @@
     this.infoServer = new StatusHttpServer("datanode", infoServerBindAddress, infoServerPort,
true);
     this.infoServer.addServlet(null, "/streamFile/*", StreamFile.class);
     this.infoServer.start();
-    this.dnRegistration.infoPort = this.infoServer.getPort();
+    // adjust info port
+    this.dnRegistration.setInfoPort(this.infoServer.getPort());
     // get network location
     this.networkLoc = conf.get("dfs.datanode.rack");
     if (networkLoc == null)  // exec network script or set the default rack

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DatanodeRegistration.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DatanodeRegistration.java?view=diff&rev=548507&r1=548506&r2=548507
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DatanodeRegistration.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DatanodeRegistration.java Mon Jun 18
15:05:27 2007
@@ -38,11 +38,21 @@
   /**
    * Create DatanodeRegistration
    */
-  public DatanodeRegistration(String nodeName, 
-                              int infoPort,
-                              DataStorage storage) {
-    super(nodeName, storage.getStorageID(), infoPort);
+  public DatanodeRegistration(String nodeName) {
+    super(nodeName, "", -1);
+    this.storageInfo = new StorageInfo();
+  }
+  
+  void setInfoPort(int infoPort) {
+    this.infoPort = infoPort;
+  }
+  
+  void setStorageInfo(DataStorage storage) {
     this.storageInfo = new StorageInfo(storage);
+  }
+  
+  void setName(String name) {
+    this.name = name;
   }
 
   /**

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/NameNode.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/NameNode.java?view=diff&rev=548507&r1=548506&r2=548507
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/NameNode.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/NameNode.java Mon Jun 18 15:05:27 2007
@@ -646,7 +646,8 @@
                           int errorCode, 
                           String msg) throws IOException {
     // Log error message from datanode
-    LOG.info("Report from " + nodeReg.getName() + ": " + msg);
+    String dnName = (nodeReg == null ? "unknown DataNode" : nodeReg.getName());
+    LOG.info("Error report from " + dnName + ": " + msg);
     if (errorCode == DatanodeProtocol.NOTIFY) {
       return;
     }

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/Storage.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/Storage.java?view=diff&rev=548507&r1=548506&r2=548507
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/Storage.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/Storage.java Mon Jun 18 15:05:27 2007
@@ -23,6 +23,7 @@
 import java.io.IOException;
 import java.io.RandomAccessFile;
 import java.nio.channels.FileLock;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Iterator;
 import java.util.Properties;
@@ -115,7 +116,7 @@
   }
   
   private NodeType storageType;    // Type of the node using this storage 
-  protected List<StorageDirectory> storageDirs;
+  protected List<StorageDirectory> storageDirs = new ArrayList<StorageDirectory>();
   
   /**
    * One of the storage directories.



Mime
View raw message