MAPREDUCE-3696. MR job via oozie does not work on hadoop 23. (John George via mahadev) - Merging r1239310 from trunk.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1239312 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
55086e5778
commit
4c38e6aa9b
|
@ -20,6 +20,16 @@
|
||||||
# Resolve links ($0 may be a softlink) and convert a relative path
|
# Resolve links ($0 may be a softlink) and convert a relative path
|
||||||
# to an absolute path. NB: The -P option requires bash built-ins
|
# to an absolute path. NB: The -P option requires bash built-ins
|
||||||
# or POSIX:2001 compliant cd and pwd.
|
# or POSIX:2001 compliant cd and pwd.
|
||||||
|
|
||||||
|
# HADOOP_CLASSPATH Extra Java CLASSPATH entries.
|
||||||
|
#
|
||||||
|
# HADOOP_USER_CLASSPATH_FIRST When defined, the HADOOP_CLASSPATH is
|
||||||
|
# added in the beginning of the global
|
||||||
|
# classpath. Can be defined, for example,
|
||||||
|
# by doing
|
||||||
|
# export HADOOP_USER_CLASSPATH_FIRST=true
|
||||||
|
#
|
||||||
|
|
||||||
this="${BASH_SOURCE-$0}"
|
this="${BASH_SOURCE-$0}"
|
||||||
common_bin=$(cd -P -- "$(dirname -- "$this")" && pwd -P)
|
common_bin=$(cd -P -- "$(dirname -- "$this")" && pwd -P)
|
||||||
script="$(basename -- "$this")"
|
script="$(basename -- "$this")"
|
||||||
|
@ -153,6 +163,10 @@ fi
|
||||||
# CLASSPATH initially contains $HADOOP_CONF_DIR
|
# CLASSPATH initially contains $HADOOP_CONF_DIR
|
||||||
CLASSPATH="${HADOOP_CONF_DIR}"
|
CLASSPATH="${HADOOP_CONF_DIR}"
|
||||||
|
|
||||||
|
if [ "$HADOOP_USER_CLASSPATH_FIRST" != "" ] && [ "$HADOOP_CLASSPATH" != "" ] ; then
|
||||||
|
CLASSPATH=${CLASSPATH}:${HADOOP_CLASSPATH}
|
||||||
|
fi
|
||||||
|
|
||||||
# so that filenames w/ spaces are handled correctly in loops below
|
# so that filenames w/ spaces are handled correctly in loops below
|
||||||
IFS=
|
IFS=
|
||||||
|
|
||||||
|
@ -174,7 +188,7 @@ fi
|
||||||
CLASSPATH=${CLASSPATH}:$HADOOP_COMMON_HOME/$HADOOP_COMMON_DIR'/*'
|
CLASSPATH=${CLASSPATH}:$HADOOP_COMMON_HOME/$HADOOP_COMMON_DIR'/*'
|
||||||
|
|
||||||
# add user-specified CLASSPATH last
|
# add user-specified CLASSPATH last
|
||||||
if [ "$HADOOP_CLASSPATH" != "" ]; then
|
if [ "$HADOOP_USER_CLASSPATH_FIRST" = "" ] && [ "$HADOOP_CLASSPATH" != "" ]; then
|
||||||
CLASSPATH=${CLASSPATH}:${HADOOP_CLASSPATH}
|
CLASSPATH=${CLASSPATH}:${HADOOP_CLASSPATH}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -597,6 +597,9 @@ Release 0.23.1 - Unreleased
|
||||||
MAPREDUCE-3499. New MiniMR does not setup proxyuser configuration
|
MAPREDUCE-3499. New MiniMR does not setup proxyuser configuration
|
||||||
correctly, thus tests using doAs do not work. (johnvijoe via tucu)
|
correctly, thus tests using doAs do not work. (johnvijoe via tucu)
|
||||||
|
|
||||||
|
MAPREDUCE-3696. MR job via oozie does not work on hadoop 23.
|
||||||
|
(John George via mahadev)
|
||||||
|
|
||||||
Release 0.23.0 - 2011-11-01
|
Release 0.23.0 - 2011-11-01
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -227,6 +227,12 @@ public class MRApps extends Apps {
|
||||||
|
|
||||||
public static void setClasspath(Map<String, String> environment,
|
public static void setClasspath(Map<String, String> environment,
|
||||||
Configuration conf) throws IOException {
|
Configuration conf) throws IOException {
|
||||||
|
boolean userClassesTakesPrecedence =
|
||||||
|
conf.getBoolean(MRJobConfig.MAPREDUCE_JOB_USER_CLASSPATH_FIRST, false);
|
||||||
|
|
||||||
|
if (!userClassesTakesPrecedence) {
|
||||||
|
MRApps.setMRFrameworkClasspath(environment, conf);
|
||||||
|
}
|
||||||
Apps.addToEnvironment(
|
Apps.addToEnvironment(
|
||||||
environment,
|
environment,
|
||||||
Environment.CLASSPATH.name(),
|
Environment.CLASSPATH.name(),
|
||||||
|
@ -235,8 +241,10 @@ public class MRApps extends Apps {
|
||||||
environment,
|
environment,
|
||||||
Environment.CLASSPATH.name(),
|
Environment.CLASSPATH.name(),
|
||||||
Environment.PWD.$() + Path.SEPARATOR + "*");
|
Environment.PWD.$() + Path.SEPARATOR + "*");
|
||||||
|
if (userClassesTakesPrecedence) {
|
||||||
MRApps.setMRFrameworkClasspath(environment, conf);
|
MRApps.setMRFrameworkClasspath(environment, conf);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static final String STAGING_CONSTANT = ".staging";
|
private static final String STAGING_CONSTANT = ".staging";
|
||||||
public static Path getStagingAreaDir(Configuration conf, String user) {
|
public static Path getStagingAreaDir(Configuration conf, String user) {
|
||||||
|
|
|
@ -130,13 +130,43 @@ 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("job.jar:$PWD/*:$HADOOP_CONF_DIR:" +
|
assertEquals("$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/*:" +
|
||||||
"$HADOOP_HDFS_HOME/share/hadoop/hdfs/lib/*:" +
|
"$HADOOP_HDFS_HOME/share/hadoop/hdfs/lib/*:" +
|
||||||
"$YARN_HOME/share/hadoop/mapreduce/*:" +
|
"$YARN_HOME/share/hadoop/mapreduce/*:" +
|
||||||
"$YARN_HOME/share/hadoop/mapreduce/lib/*",
|
"$YARN_HOME/share/hadoop/mapreduce/lib/*:" +
|
||||||
|
"job.jar:$PWD/*",
|
||||||
environment.get("CLASSPATH"));
|
environment.get("CLASSPATH"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test public void testSetClasspathWithUserPrecendence() {
|
||||||
|
Configuration conf = new Configuration();
|
||||||
|
conf.setBoolean(MRJobConfig.MAPREDUCE_JOB_USER_CLASSPATH_FIRST, true);
|
||||||
|
Map<String, String> env = new HashMap<String, String>();
|
||||||
|
try {
|
||||||
|
MRApps.setClasspath(env, conf);
|
||||||
|
} catch (Exception e) {
|
||||||
|
fail("Got exception while setting classpath");
|
||||||
|
}
|
||||||
|
String env_str = env.get("CLASSPATH");
|
||||||
|
assertSame("MAPREDUCE_JOB_USER_CLASSPATH_FIRST set, but not taking effect!",
|
||||||
|
env_str.indexOf("job.jar"), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test public void testSetClasspathWithNoUserPrecendence() {
|
||||||
|
Configuration conf = new Configuration();
|
||||||
|
conf.setBoolean(MRJobConfig.MAPREDUCE_JOB_USER_CLASSPATH_FIRST, false);
|
||||||
|
Map<String, String> env = new HashMap<String, String>();
|
||||||
|
try {
|
||||||
|
MRApps.setClasspath(env, conf);
|
||||||
|
} catch (Exception e) {
|
||||||
|
fail("Got exception while setting classpath");
|
||||||
|
}
|
||||||
|
String env_str = env.get("CLASSPATH");
|
||||||
|
assertNotSame("MAPREDUCE_JOB_USER_CLASSPATH_FIRST false, but taking effect!",
|
||||||
|
env_str.indexOf("job.jar"), 0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,6 +118,8 @@ public interface MRJobConfig {
|
||||||
|
|
||||||
public static final String USER_LOG_RETAIN_HOURS = "mapreduce.job.userlog.retain.hours";
|
public static final String USER_LOG_RETAIN_HOURS = "mapreduce.job.userlog.retain.hours";
|
||||||
|
|
||||||
|
public static final String MAPREDUCE_JOB_USER_CLASSPATH_FIRST = "mapreduce.job.user.classpath.first";
|
||||||
|
|
||||||
public static final String IO_SORT_FACTOR = "mapreduce.task.io.sort.factor";
|
public static final String IO_SORT_FACTOR = "mapreduce.task.io.sort.factor";
|
||||||
|
|
||||||
public static final String IO_SORT_MB = "mapreduce.task.io.sort.mb";
|
public static final String IO_SORT_MB = "mapreduce.task.io.sort.mb";
|
||||||
|
|
|
@ -408,7 +408,7 @@ public class YARNRunner implements ClientProtocol {
|
||||||
+ mergedCommand);
|
+ mergedCommand);
|
||||||
|
|
||||||
// Setup the CLASSPATH in environment
|
// Setup the CLASSPATH in environment
|
||||||
// i.e. add { job jar, CWD, Hadoop jars} to classpath.
|
// i.e. add { Hadoop jars, job jar, CWD } to classpath.
|
||||||
Map<String, String> environment = new HashMap<String, String>();
|
Map<String, String> environment = new HashMap<String, String>();
|
||||||
MRApps.setClasspath(environment, conf);
|
MRApps.setClasspath(environment, conf);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue