Merge -r 1292423:1292424 from trunk to branch. FIXES: MAPREDUCE-3884

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1292427 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Alejandro Abdelnur 2012-02-22 18:03:27 +00:00
parent 55a3a13afa
commit b512e9f282
3 changed files with 8 additions and 3 deletions

View File

@ -41,6 +41,8 @@ Release 0.23.2 - UNRELEASED
MAPREDUCE-3798. Fixed failing TestJobCleanup.testCusomCleanup() and moved it MAPREDUCE-3798. Fixed failing TestJobCleanup.testCusomCleanup() and moved it
to the maven build. (Ravi Prakash via vinodkv) to the maven build. (Ravi Prakash via vinodkv)
MAPREDUCE-3884. PWD should be first in the classpath of MR tasks (tucu)
Release 0.23.1 - 2012-02-17 Release 0.23.1 - 2012-02-17
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -230,6 +230,9 @@ public class MRApps extends Apps {
boolean userClassesTakesPrecedence = boolean userClassesTakesPrecedence =
conf.getBoolean(MRJobConfig.MAPREDUCE_JOB_USER_CLASSPATH_FIRST, false); conf.getBoolean(MRJobConfig.MAPREDUCE_JOB_USER_CLASSPATH_FIRST, false);
Apps.addToEnvironment(environment,
Environment.CLASSPATH.name(),
Environment.PWD.$());
if (!userClassesTakesPrecedence) { if (!userClassesTakesPrecedence) {
MRApps.setMRFrameworkClasspath(environment, conf); MRApps.setMRFrameworkClasspath(environment, conf);
} }

View File

@ -130,7 +130,7 @@ public class TestMRApps {
Job job = Job.getInstance(); Job job = Job.getInstance();
Map<String, String> environment = new HashMap<String, String>(); Map<String, String> environment = new HashMap<String, String>();
MRApps.setClasspath(environment, job.getConfiguration()); MRApps.setClasspath(environment, job.getConfiguration());
assertEquals("$HADOOP_CONF_DIR:" + assertEquals("$PWD:$HADOOP_CONF_DIR:" +
"$HADOOP_COMMON_HOME/share/hadoop/common/*:" + "$HADOOP_COMMON_HOME/share/hadoop/common/*:" +
"$HADOOP_COMMON_HOME/share/hadoop/common/lib/*:" + "$HADOOP_COMMON_HOME/share/hadoop/common/lib/*:" +
"$HADOOP_HDFS_HOME/share/hadoop/hdfs/*:" + "$HADOOP_HDFS_HOME/share/hadoop/hdfs/*:" +
@ -152,7 +152,7 @@ public class TestMRApps {
} }
String env_str = env.get("CLASSPATH"); String env_str = env.get("CLASSPATH");
assertSame("MAPREDUCE_JOB_USER_CLASSPATH_FIRST set, but not taking effect!", assertSame("MAPREDUCE_JOB_USER_CLASSPATH_FIRST set, but not taking effect!",
env_str.indexOf("job.jar"), 0); env_str.indexOf("$PWD:job.jar"), 0);
} }
@Test public void testSetClasspathWithNoUserPrecendence() { @Test public void testSetClasspathWithNoUserPrecendence() {
@ -166,7 +166,7 @@ public class TestMRApps {
} }
String env_str = env.get("CLASSPATH"); String env_str = env.get("CLASSPATH");
assertNotSame("MAPREDUCE_JOB_USER_CLASSPATH_FIRST false, but taking effect!", assertNotSame("MAPREDUCE_JOB_USER_CLASSPATH_FIRST false, but taking effect!",
env_str.indexOf("job.jar"), 0); env_str.indexOf("$PWD:job.jar"), 0);
} }
} }