Author: eli
Date: Tue Nov 16 02:07:45 2010
New Revision: 1035515

URL: http://svn.apache.org/viewvc?rev=1035515&view=rev
Log:
HDFS-874. TestHDFSFileContextMainOperations fails on weirdly configured DNS 
hosts. Contributed by Todd Lipcon

Modified:
    hadoop/hdfs/trunk/CHANGES.txt
    hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/MiniDFSCluster.java

Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=1035515&r1=1035514&r2=1035515&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Tue Nov 16 02:07:45 2010
@@ -345,6 +345,9 @@ Trunk (unreleased changes)
 
     HDFS-1466. TestFcHdfsSymlink relies on /tmp/test not existing. (eli)
 
+    HDFS-874. TestHDFSFileContextMainOperations fails on weirdly 
+    configured DNS hosts. (Todd Lipcon via eli)
+
 Release 0.21.1 - Unreleased
 
   IMPROVEMENTS

Modified: 
hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/MiniDFSCluster.java
URL: 
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/MiniDFSCluster.java?rev=1035515&r1=1035514&r2=1035515&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/MiniDFSCluster.java 
(original)
+++ hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/MiniDFSCluster.java 
Tue Nov 16 02:07:45 2010
@@ -448,13 +448,7 @@ public class MiniDFSCluster {
     startDataNodes(conf, numDataNodes, manageDataDfsDirs, 
                     operation, racks, hosts, simulatedCapacities);
     waitClusterUp();
-    String myUriStr = "hdfs://localhost:"+ 
Integer.toString(this.getNameNodePort());
-    try {
-      this.myUri = new URI(myUriStr);
-    } catch (URISyntaxException e) {
-      NameNode.LOG.warn("unexpected URISyntaxException: " + e );
-    }
-    
+
     //make sure ProxyUsers uses the latest conf
     ProxyUsers.refreshSuperUserGroupsConfiguration(conf);
   }
@@ -534,11 +528,15 @@ public class MiniDFSCluster {
     if (nameNode != null) { // set conf from the name node
       InetSocketAddress nnAddr = nameNode.getNameNodeAddress(); 
       int nameNodePort = nnAddr.getPort(); 
-      FileSystem.setDefaultUri(conf, 
-                               "hdfs://"+ nnAddr.getHostName() +
-                               ":" + Integer.toString(nameNodePort));
+      try {
+         myUri = new URI("hdfs://"+ nnAddr.getHostName() + ":" +
+                         Integer.toString(nameNodePort));
+      } catch (URISyntaxException e) {
+         throw new IOException("Couldn't parse own URI", e);
+      }
+      FileSystem.setDefaultUri(conf, myUri);
     }
-    
+
     if (racks != null && numDataNodes > racks.length ) {
       throw new IllegalArgumentException( "The length of racks [" + 
racks.length
           + "] is less than the number of datanodes [" + numDataNodes + "].");


Reply via email to