hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rang...@apache.org
Subject svn commit: r644994 - in /hadoop/core/trunk: CHANGES.txt src/java/org/apache/hadoop/filecache/DistributedCache.java src/test/org/apache/hadoop/mapred/TestMiniMRLocalFS.java
Date Fri, 04 Apr 2008 23:48:30 GMT
Author: rangadi
Date: Fri Apr  4 16:48:20 2008
New Revision: 644994

URL: http://svn.apache.org/viewvc?rev=644994&view=rev
Log:
HADOOP-3157. Fix path handling in DistributedCache and TestMiniMRLocalFS. (Doug Cutting via
rangadi)

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/java/org/apache/hadoop/filecache/DistributedCache.java
    hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRLocalFS.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=644994&r1=644993&r2=644994&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Fri Apr  4 16:48:20 2008
@@ -517,6 +517,9 @@
     HADOOP-1911. Fix an infinite loop in DFSClient when all replicas of a
     block are bad (cdouglas)
 
+    HADOOP-3157. Fix path handling in DistributedCache and TestMiniMRLocalFS.
+    (Doug Cutting via rangadi) 
+
 Release 0.16.3 - Unreleased
 
   BUG FIXES

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/filecache/DistributedCache.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/filecache/DistributedCache.java?rev=644994&r1=644993&r2=644994&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/filecache/DistributedCache.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/filecache/DistributedCache.java Fri Apr 
4 16:48:20 2008
@@ -257,15 +257,19 @@
    */
   public static String makeRelative(URI cache, Configuration conf)
     throws IOException {
-    String fsname = cache.getScheme();
-    String path;
-    FileSystem dfs = FileSystem.get(conf);
-    if ("hdfs".equals(fsname)) {
-      path = cache.getHost() + cache.getPath();
-    } else {
-      String[] split = dfs.getName().split(":");
-      path = split[0] + cache.getPath();
+    String host = cache.getHost();
+    if (host == null) {
+      host = cache.getScheme();
     }
+    if (host == null) {
+      URI defaultUri = FileSystem.get(conf).getUri();
+      host = defaultUri.getHost();
+      if (host == null) {
+        host = defaultUri.getScheme();
+      }
+    }
+    String path = host + cache.getPath();
+    path = path.replace(":/","/");                // remove windows device colon
     return path;
   }
 

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRLocalFS.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRLocalFS.java?rev=644994&r1=644993&r2=644994&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRLocalFS.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/mapred/TestMiniMRLocalFS.java Fri Apr  4
16:48:20 2008
@@ -41,7 +41,7 @@
   static final int NUM_SAMPLES = 100000;
   private static String TEST_ROOT_DIR =
     new File(System.getProperty("test.build.data","/tmp"))
-    .toString().replace(' ', '+');
+    .toURI().toString().replace(' ', '+');
     
   public void testWithLocal() throws IOException {
     MiniMRCluster mr = null;



Mime
View raw message