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 ss...@apache.org on 2012/10/03 04:33:44 UTC
svn commit: r1393260 - in /hadoop/common/branches/branch-1: CHANGES.txt
src/mapred/org/apache/hadoop/mapred/JobTracker.java
src/test/org/apache/hadoop/mapred/TestJobHistoryConfig.java
Author: sseth
Date: Wed Oct 3 02:33:43 2012
New Revision: 1393260
URL: http://svn.apache.org/viewvc?rev=1393260&view=rev
Log:
MAPREDUCE-4698. Fix failing unit test - TestJobHistoryConfig. Optionally initialize the jobtracker on a JobTracker.startTracker. (Contributed by Gopal V)
Modified:
hadoop/common/branches/branch-1/CHANGES.txt
hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapred/JobTracker.java
hadoop/common/branches/branch-1/src/test/org/apache/hadoop/mapred/TestJobHistoryConfig.java
Modified: hadoop/common/branches/branch-1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/CHANGES.txt?rev=1393260&r1=1393259&r2=1393260&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1/CHANGES.txt Wed Oct 3 02:33:43 2012
@@ -614,6 +614,9 @@ Release 1.1.0 - unreleased
getting, renewing, and cancelling the underlying token. Systems with
weak crypto (kssl) configured will continue to use https. (omalley)
+ MAPREDUCE-4698. Fix failing unit test - TestJobHistoryConfig. Optionally
+ initialize the jobtracker on a JobTracker.startTracker. (Gopal V via sseth)
+
Release 1.0.4 - Unreleased
NEW FEATURES
Modified: hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapred/JobTracker.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapred/JobTracker.java?rev=1393260&r1=1393259&r2=1393260&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapred/JobTracker.java (original)
+++ hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapred/JobTracker.java Wed Oct 3 02:33:43 2012
@@ -299,9 +299,14 @@ public class JobTracker implements MRCon
InterruptedException {
return startTracker(conf, generateNewIdentifier());
}
-
+
public static JobTracker startTracker(JobConf conf, String identifier)
throws IOException, InterruptedException {
+ return startTracker(conf, identifier, false);
+ }
+
+ public static JobTracker startTracker(JobConf conf, String identifier, boolean initialize)
+ throws IOException, InterruptedException {
DefaultMetricsSystem.initialize("JobTracker");
JobTracker result = null;
while (true) {
@@ -328,6 +333,12 @@ public class JobTracker implements MRCon
if (result != null) {
JobEndNotifier.startNotifier();
MBeans.register("JobTracker", "JobTrackerInfo", result);
+ if(initialize == true) {
+ result.setSafeModeInternal(SafeModeAction.SAFEMODE_ENTER);
+ result.initializeFilesystem();
+ result.setSafeModeInternal(SafeModeAction.SAFEMODE_LEAVE);
+ result.initialize();
+ }
}
return result;
}
Modified: hadoop/common/branches/branch-1/src/test/org/apache/hadoop/mapred/TestJobHistoryConfig.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/test/org/apache/hadoop/mapred/TestJobHistoryConfig.java?rev=1393260&r1=1393259&r2=1393260&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/test/org/apache/hadoop/mapred/TestJobHistoryConfig.java (original)
+++ hadoop/common/branches/branch-1/src/test/org/apache/hadoop/mapred/TestJobHistoryConfig.java Wed Oct 3 02:33:43 2012
@@ -17,8 +17,10 @@
*/
package org.apache.hadoop.mapred;
+import java.util.Date;
import java.io.IOException;
import java.io.PrintWriter;
+import java.text.SimpleDateFormat;
import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.hadoop.io.LongWritable;
@@ -113,7 +115,8 @@ public class TestJobHistoryConfig extend
conf.setQueueName("default");
String TEST_ROOT_DIR = new Path(System.getProperty("test.build.data",
"/tmp")).toString().replace(' ', '+');
- JobTracker jt = JobTracker.startTracker(conf);
+ String uniqid = new SimpleDateFormat("yyyyMMddHHmm").format(new Date());
+ JobTracker jt = JobTracker.startTracker(conf, uniqid, true);
assertTrue(jt != null);
JobInProgress jip = new JobInProgress(new JobID("jt", 1),
new JobConf(conf), jt);
@@ -132,8 +135,9 @@ public class TestJobHistoryConfig extend
private boolean canStartJobTracker(JobConf conf) throws InterruptedException,
IOException {
JobTracker jt = null;
+ String uniqid = new SimpleDateFormat("yyyyMMddHHmm").format(new Date());
try {
- jt = JobTracker.startTracker(conf);
+ jt = JobTracker.startTracker(conf, uniqid, true);
Log.info("Started JobTracker");
} catch (IOException e) {
Log.info("Can not Start JobTracker", e.getLocalizedMessage());