hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r1487093 - in /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs: CHANGES.txt src/main/java/org/apache/hadoop/hdfs/DFSClient.java src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeManager.java
Date Tue, 28 May 2013 20:17:39 GMT
Author: ddas
Date: Tue May 28 20:17:39 2013
New Revision: 1487093

URL: http://svn.apache.org/r1487093
Log:
HDFS-4827. Slight update to the implementation of API for handling favored nodes in DFSClient.
Contributed by Devaraj Das.

Modified:
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeManager.java

Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1487093&r1=1487092&r2=1487093&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Tue May 28 20:17:39 2013
@@ -894,6 +894,9 @@ Release 2.0.5-beta - UNRELEASED
     HDFS-4780. Use the correct relogin method for services. (Robert Parker via
     kihwal)
 
+    HDFS-4827. Slight update to the implementation of API for handling favored
+    nodes in DFSClient (ddas)
+
   BREAKDOWN OF HDFS-347 SUBTASKS AND RELATED JIRAS
 
     HDFS-4353. Encapsulate connections to peers in Peer and PeerServer classes.

Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java?rev=1487093&r1=1487092&r2=1487093&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java
(original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java
Tue May 28 20:17:39 2013
@@ -1278,7 +1278,7 @@ public class DFSClient implements java.i
       favoredNodeStrs = new String[favoredNodes.length];
       for (int i = 0; i < favoredNodes.length; i++) {
         favoredNodeStrs[i] = 
-            favoredNodes[i].getAddress().getHostAddress() + ":" 
+            favoredNodes[i].getHostName() + ":" 
                          + favoredNodes[i].getPort();
       }
     }

Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeManager.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeManager.java?rev=1487093&r1=1487092&r2=1487093&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeManager.java
(original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeManager.java
Tue May 28 20:17:39 2013
@@ -341,20 +341,15 @@ public class DatanodeManager {
    * @return the best match for the given datanode
    */
   DatanodeDescriptor getDatanodeDescriptor(String address) {
-    DatanodeDescriptor node = null;
-    int colon = address.indexOf(":");
-    int xferPort;
-    String host = address;
-    if (colon > 0) {
-      host = address.substring(0, colon);
-      xferPort = Integer.parseInt(address.substring(colon+1));
-      node = getDatanodeByXferAddr(host, xferPort);
-    }
+    DatanodeID dnId = parseDNFromHostsEntry(address);
+    String host = dnId.getIpAddr();
+    int xferPort = dnId.getXferPort();
+    DatanodeDescriptor node = getDatanodeByXferAddr(host, xferPort);
     if (node == null) {
       node = getDatanodeByHost(host);
     }
     if (node == null) {
-      String networkLocation = resolveNetworkLocation(host);
+      String networkLocation = resolveNetworkLocation(dnId);
 
       // If the current cluster doesn't contain the node, fallback to
       // something machine local and then rack local.
@@ -516,11 +511,6 @@ public class DatanodeManager {
     }
   }
 
-  public String resolveNetworkLocation(String host) {
-    DatanodeID d = parseDNFromHostsEntry(host);
-    return resolveNetworkLocation(d);
-  }
-
   /* Resolve a node's network location */
   private String resolveNetworkLocation (DatanodeID node) {
     List<String> names = new ArrayList<String>(1);



Mime
View raw message