MAPREDUCE-5442. $HADOOP_MAPRED_HOME/$HADOOP_CONF_DIR setting not working on Windows. Contributed by Yingda Chen.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1529077 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris Nauroth 2013-10-04 05:37:54 +00:00
parent 6ff600d9e3
commit 65cd7bf6b1
5 changed files with 27 additions and 8 deletions

View File

@ -275,6 +275,9 @@ Release 2.1.2 - UNRELEASED
MAPREDUCE-5489. MR jobs hangs as it does not use the node-blacklisting MAPREDUCE-5489. MR jobs hangs as it does not use the node-blacklisting
feature in RM requests (Zhijie Shen via bikas) feature in RM requests (Zhijie Shen via bikas)
MAPREDUCE-5442. $HADOOP_MAPRED_HOME/$HADOOP_CONF_DIR setting not working on
Windows. (Yingda Chen via cnauroth)
Release 2.1.1-beta - 2013-09-23 Release 2.1.1-beta - 2013-09-23
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -49,6 +49,7 @@ import org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptId;
import org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptState; import org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptState;
import org.apache.hadoop.mapreduce.v2.api.records.TaskId; import org.apache.hadoop.mapreduce.v2.api.records.TaskId;
import org.apache.hadoop.mapreduce.v2.api.records.TaskType; import org.apache.hadoop.mapreduce.v2.api.records.TaskType;
import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.yarn.ContainerLogAppender; import org.apache.hadoop.yarn.ContainerLogAppender;
import org.apache.hadoop.yarn.api.ApplicationConstants; import org.apache.hadoop.yarn.api.ApplicationConstants;
import org.apache.hadoop.yarn.api.ApplicationConstants.Environment; import org.apache.hadoop.yarn.api.ApplicationConstants.Environment;
@ -181,7 +182,8 @@ public class MRApps extends Apps {
boolean foundFrameworkInClasspath = (frameworkName == null); boolean foundFrameworkInClasspath = (frameworkName == null);
for (String c : conf.getStrings( for (String c : conf.getStrings(
MRJobConfig.MAPREDUCE_APPLICATION_CLASSPATH, MRJobConfig.MAPREDUCE_APPLICATION_CLASSPATH,
MRJobConfig.DEFAULT_MAPREDUCE_APPLICATION_CLASSPATH)) { StringUtils.getStrings(
MRJobConfig.DEFAULT_MAPREDUCE_APPLICATION_CLASSPATH))){
Apps.addToEnvironment(environment, Environment.CLASSPATH.name(), c Apps.addToEnvironment(environment, Environment.CLASSPATH.name(), c
.trim()); .trim());
if (!foundFrameworkInClasspath) { if (!foundFrameworkInClasspath) {

View File

@ -191,7 +191,9 @@ public class TestMRApps {
} }
assertTrue(environment.get("CLASSPATH").contains(yarnAppClasspath)); assertTrue(environment.get("CLASSPATH").contains(yarnAppClasspath));
String mrAppClasspath = String mrAppClasspath =
job.getConfiguration().get(MRJobConfig.MAPREDUCE_APPLICATION_CLASSPATH); job.getConfiguration().get(
MRJobConfig.MAPREDUCE_APPLICATION_CLASSPATH,
MRJobConfig.DEFAULT_MAPREDUCE_APPLICATION_CLASSPATH);
if (mrAppClasspath != null) { if (mrAppClasspath != null) {
mrAppClasspath = mrAppClasspath.replaceAll(",\\s*", File.pathSeparator) mrAppClasspath = mrAppClasspath.replaceAll(",\\s*", File.pathSeparator)
.trim(); .trim();

View File

@ -19,6 +19,7 @@ package org.apache.hadoop.mapreduce;
import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.util.Shell;
@InterfaceAudience.Private @InterfaceAudience.Private
@InterfaceStability.Evolving @InterfaceStability.Evolving
@ -658,10 +659,12 @@ public interface MRJobConfig {
/** /**
* Default CLASSPATH for all YARN MapReduce applications. * Default CLASSPATH for all YARN MapReduce applications.
*/ */
public static final String[] DEFAULT_MAPREDUCE_APPLICATION_CLASSPATH = { public final String
"$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/*", DEFAULT_MAPREDUCE_APPLICATION_CLASSPATH = Shell.WINDOWS ?
"$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/lib/*", "%HADOOP_MAPRED_HOME%\\share\\hadoop\\mapreduce\\*,"
}; + "%HADOOP_MAPRED_HOME%\\share\\hadoop\\mapreduce\\lib\\*" :
"$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/*,"
+ "$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/lib/*";
public static final String WORKFLOW_ID = "mapreduce.workflow.id"; public static final String WORKFLOW_ID = "mapreduce.workflow.id";

View File

@ -1026,9 +1026,18 @@
<description>CLASSPATH for MR applications. A comma-separated list <description>CLASSPATH for MR applications. A comma-separated list
of CLASSPATH entries. If mapreduce.application.framework is set then this of CLASSPATH entries. If mapreduce.application.framework is set then this
must specify the appropriate classpath for that archive, and the name of must specify the appropriate classpath for that archive, and the name of
the archive must be present in the classpath.</description> the archive must be present in the classpath.
When this value is empty, the following default CLASSPATH for MR
applications would be used.
For Linux:
$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/*,
$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/lib/*.
For Windows:
%HADOOP_MAPRED_HOME%/share/hadoop/mapreduce/*,
%HADOOP_MAPRED_HOME%/share/hadoop/mapreduce/lib/*.
</description>
<name>mapreduce.application.classpath</name> <name>mapreduce.application.classpath</name>
<value>$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/*,$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/lib/*</value> <value></value>
</property> </property>
<property> <property>