MAPREDUCE-6503. archive-logs tool should use HADOOP_PREFIX instead of HADOOP_HOME (rkanter)

(cherry picked from commit 1bca1bb517)
This commit is contained in:
Robert Kanter 2015-10-06 16:49:50 -07:00
parent fa3e774295
commit e5bf4594cc
3 changed files with 6 additions and 3 deletions

View File

@ -322,6 +322,9 @@ Release 2.8.0 - UNRELEASED
MAPREDUCE-6485. Create a new task attempt with failed map task priority MAPREDUCE-6485. Create a new task attempt with failed map task priority
if in-progress attempts are unassigned. (Xianyin Xin via rohithsharmaks) if in-progress attempts are unassigned. (Xianyin Xin via rohithsharmaks)
MAPREDUCE-6503. archive-logs tool should use HADOOP_PREFIX instead
of HADOOP_HOME (rkanter)
Release 2.7.2 - UNRELEASED Release 2.7.2 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -437,7 +437,7 @@ public class HadoopArchiveLogs implements Tool {
fi fi
export HADOOP_CLIENT_OPTS="-Xmx1024m" export HADOOP_CLIENT_OPTS="-Xmx1024m"
export HADOOP_CLASSPATH=/dist/share/hadoop/tools/lib/hadoop-archive-logs-2.8.0-SNAPSHOT.jar:/dist/share/hadoop/tools/lib/hadoop-archives-2.8.0-SNAPSHOT.jar export HADOOP_CLASSPATH=/dist/share/hadoop/tools/lib/hadoop-archive-logs-2.8.0-SNAPSHOT.jar:/dist/share/hadoop/tools/lib/hadoop-archives-2.8.0-SNAPSHOT.jar
"$HADOOP_HOME"/bin/hadoop org.apache.hadoop.tools.HadoopArchiveLogsRunner -appId "$appId" -user "$user" -workingDir /tmp/logs/archive-logs-work -remoteRootLogDir /tmp/logs -suffix logs "$HADOOP_PREFIX"/bin/hadoop org.apache.hadoop.tools.HadoopArchiveLogsRunner -appId "$appId" -user "$user" -workingDir /tmp/logs/archive-logs-work -remoteRootLogDir /tmp/logs -suffix logs
*/ */
@VisibleForTesting @VisibleForTesting
void generateScript(File localScript, Path workingDir, void generateScript(File localScript, Path workingDir,
@ -471,7 +471,7 @@ public class HadoopArchiveLogs implements Tool {
fw.write("m\"\n"); fw.write("m\"\n");
fw.write("export HADOOP_CLASSPATH="); fw.write("export HADOOP_CLASSPATH=");
fw.write(classpath); fw.write(classpath);
fw.write("\n\"$HADOOP_HOME\"/bin/hadoop "); fw.write("\n\"$HADOOP_PREFIX\"/bin/hadoop ");
fw.write(HadoopArchiveLogsRunner.class.getName()); fw.write(HadoopArchiveLogsRunner.class.getName());
fw.write(" -appId \"$appId\" -user \"$user\" -workingDir "); fw.write(" -appId \"$appId\" -user \"$user\" -workingDir ");
fw.write(workingDir.toString()); fw.write(workingDir.toString());

View File

@ -286,7 +286,7 @@ public class TestHadoopArchiveLogs {
Assert.assertEquals("fi", lines[12]); Assert.assertEquals("fi", lines[12]);
Assert.assertEquals("export HADOOP_CLIENT_OPTS=\"-Xmx1024m\"", lines[13]); Assert.assertEquals("export HADOOP_CLIENT_OPTS=\"-Xmx1024m\"", lines[13]);
Assert.assertTrue(lines[14].startsWith("export HADOOP_CLASSPATH=")); Assert.assertTrue(lines[14].startsWith("export HADOOP_CLASSPATH="));
Assert.assertEquals("\"$HADOOP_HOME\"/bin/hadoop org.apache.hadoop.tools." + Assert.assertEquals("\"$HADOOP_PREFIX\"/bin/hadoop org.apache.hadoop.tools." +
"HadoopArchiveLogsRunner -appId \"$appId\" -user \"$user\" -workingDir " "HadoopArchiveLogsRunner -appId \"$appId\" -user \"$user\" -workingDir "
+ workingDir.toString() + " -remoteRootLogDir " + + workingDir.toString() + " -remoteRootLogDir " +
remoteRootLogDir.toString() + " -suffix " + suffix, lines[15]); remoteRootLogDir.toString() + " -suffix " + suffix, lines[15]);