You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ha...@apache.org on 2008/12/05 21:00:10 UTC
svn commit: r723839 - in /hadoop/core/branches/branch-0.18: ./ CHANGES.txt
src/hdfs/org/apache/hadoop/dfs/DistributedFileSystem.java
src/mapred/org/apache/hadoop/mapred/Task.java
src/test/org/apache/hadoop/mapred/TestMiniMRWithDFS.java
Author: hairong
Date: Fri Dec 5 12:00:09 2008
New Revision: 723839
URL: http://svn.apache.org/viewvc?rev=723839&view=rev
Log:
Merge -r 723830:723831 from trunk to move the change log of HADOOP-4717 into branch 0.18
Modified:
hadoop/core/branches/branch-0.18/ (props changed)
hadoop/core/branches/branch-0.18/CHANGES.txt (contents, props changed)
hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/DistributedFileSystem.java
hadoop/core/branches/branch-0.18/src/mapred/org/apache/hadoop/mapred/Task.java
hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/mapred/TestMiniMRWithDFS.java
Propchange: hadoop/core/branches/branch-0.18/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Dec 5 12:00:09 2008
@@ -1,2 +1,2 @@
/hadoop/core/branches/branch-0.19:704733
-/hadoop/core/trunk:699517,700163,704701,704732,705420,705430,707258,709040,720602,723460
+/hadoop/core/trunk:699517,700163,704701,704732,705420,705430,707258,709040,720602,723460,723831
Modified: hadoop/core/branches/branch-0.18/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/CHANGES.txt?rev=723839&r1=723838&r2=723839&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.18/CHANGES.txt Fri Dec 5 12:00:09 2008
@@ -75,6 +75,9 @@
tasks in the JobTracker's task commit thread.
(Amareshwari Sriramadasu via ddas)
+ HADOOP-4717. Removal of default port# in NameNode.getUri() causes a
+ map/reduce job failed to prompt temporary output. (hairong)
+
Release 0.18.2 - 2008-11-03
BUG FIXES
Propchange: hadoop/core/branches/branch-0.18/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Dec 5 12:00:09 2008
@@ -1 +1 @@
-/hadoop/core/trunk/CHANGES.txt:699517,700163,700923,704701,705420,705430,707258,709040,720602,723460
+/hadoop/core/trunk/CHANGES.txt:699517,700163,700923,704701,705420,705430,707258,709040,720602,723460,723831
Modified: hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/DistributedFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/DistributedFileSystem.java?rev=723839&r1=723838&r2=723839&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/DistributedFileSystem.java (original)
+++ hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/DistributedFileSystem.java Fri Dec 5 12:00:09 2008
@@ -84,6 +84,24 @@
super.checkPath(path);
}
+ /** Normalize paths that explicitly specify the default port. */
+ public Path makeQualified(Path path) {
+ URI thisUri = this.getUri();
+ URI thatUri = path.toUri();
+ String thatAuthority = thatUri.getAuthority();
+ if (thatUri.getScheme() != null
+ && thatUri.getScheme().equalsIgnoreCase(thisUri.getScheme())
+ && thatUri.getPort() == NameNode.DEFAULT_PORT
+ && thisUri.getPort() == -1
+ && thatAuthority.substring(0,thatAuthority.indexOf(":"))
+ .equalsIgnoreCase(thisUri.getAuthority())) {
+ path = new Path(thisUri.getScheme(), thisUri.getAuthority(),
+ thatUri.getPath());
+ }
+ return super.makeQualified(path);
+ }
+
+
public Path getWorkingDirectory() {
return workingDir;
}
Modified: hadoop/core/branches/branch-0.18/src/mapred/org/apache/hadoop/mapred/Task.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/mapred/org/apache/hadoop/mapred/Task.java?rev=723839&r1=723838&r2=723839&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/mapred/org/apache/hadoop/mapred/Task.java (original)
+++ hadoop/core/branches/branch-0.18/src/mapred/org/apache/hadoop/mapred/Task.java Fri Dec 5 12:00:09 2008
@@ -579,8 +579,13 @@
}
}
- private Path getFinalPath(Path jobOutputDir, Path taskOutput) {
- URI relativePath = taskOutputPath.toUri().relativize(taskOutput.toUri());
+ private Path getFinalPath(Path jobOutputDir, Path taskOutput) throws IOException {
+ URI taskOutputUri = taskOutput.toUri();
+ URI relativePath = taskOutputPath.toUri().relativize(taskOutputUri);
+ if (taskOutputUri == relativePath) {//taskOutputPath is not a parent of taskOutput
+ throw new IOException("Can not get the relative path: base = " +
+ taskOutputPath + " child = " + taskOutput);
+ }
if (relativePath.getPath().length() > 0) {
return new Path(jobOutputDir, relativePath.getPath());
} else {
Modified: hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/mapred/TestMiniMRWithDFS.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/mapred/TestMiniMRWithDFS.java?rev=723839&r1=723838&r2=723839&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/mapred/TestMiniMRWithDFS.java (original)
+++ hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/mapred/TestMiniMRWithDFS.java Fri Dec 5 12:00:09 2008
@@ -33,6 +33,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.dfs.MiniDFSCluster;
+import org.apache.hadoop.dfs.NameNode;
import org.apache.hadoop.examples.WordCount;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.FileUtil;
@@ -246,4 +247,37 @@
}
}
+ public void testWithDFSWithDefaultPort() throws IOException {
+ MiniDFSCluster dfs = null;
+ MiniMRCluster mr = null;
+ FileSystem fileSys = null;
+ try {
+ final int taskTrackers = 4;
+
+ Configuration conf = new Configuration();
+ // start a dfs with the default port number
+ dfs = new MiniDFSCluster(
+ NameNode.DEFAULT_PORT, conf, 4, true, true, null, null);
+ fileSys = dfs.getFileSystem();
+ mr = new MiniMRCluster(taskTrackers, fileSys.getUri().toString(), 1);
+
+ JobConf jobConf = mr.createJobConf();
+ TestResult result;
+ final Path inDir = new Path("./wc/input");
+ final Path outDir = new Path("hdfs://" +
+ dfs.getNameNode().getNameNodeAddress().getHostName() +
+ ":" + NameNode.DEFAULT_PORT +"/./wc/output");
+ String input = "The quick brown fox\nhas many silly\nred fox sox\n";
+ result = launchWordCount(jobConf, inDir, outDir, input, 3, 1);
+ assertEquals("The\t1\nbrown\t1\nfox\t2\nhas\t1\nmany\t1\n" +
+ "quick\t1\nred\t1\nsilly\t1\nsox\t1\n", result.output);
+ } catch (java.net.BindException be) {
+ LOG.info("Skip the test this time because can not start namenode on port "
+ + NameNode.DEFAULT_PORT, be);
+ } finally {
+ if (dfs != null) { dfs.shutdown(); }
+ if (mr != null) { mr.shutdown();
+ }
+ }
+ }
}