diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 0c402a69b9..b99bb9f869 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -115,6 +115,10 @@ Release 0.23.2 - UNRELEASED MAPREDUCE-3864. Fix cluster setup docs for correct SecondaryNameNode HTTPS parameters. (todd) + + MAPREDUCE-3856. Instances of RunningJob class givs incorrect job tracking + urls when mutiple jobs are submitted from same client jvm. (Eric Payne via + sseth) Release 0.23.1 - 2012-02-08 diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ClientServiceDelegate.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ClientServiceDelegate.java index b308c1a074..39e32515d1 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ClientServiceDelegate.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ClientServiceDelegate.java @@ -81,8 +81,7 @@ public class ClientServiceDelegate { private static final Log LOG = LogFactory.getLog(ClientServiceDelegate.class); // Caches for per-user NotRunningJobs - private static HashMap> notRunningJobs = - new HashMap>(); + private HashMap> notRunningJobs; private final Configuration conf; private final JobID jobId; @@ -108,6 +107,7 @@ public ClientServiceDelegate(Configuration conf, ResourceMgrDelegate rm, this.jobId = jobId; this.historyServerProxy = historyServerProxy; this.appId = TypeConverter.toYarn(jobId).getAppId(); + notRunningJobs = new HashMap>(); } // Get the instance of the NotRunningJob corresponding to the specified diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/TestMRJobs.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/TestMRJobs.java index 562e865410..59b8689b20 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/TestMRJobs.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/TestMRJobs.java @@ -148,10 +148,15 @@ public void testSleepJob() throws IOException, InterruptedException, job.addFileToClassPath(APP_JAR); // The AppMaster jar itself. job.setJarByClass(SleepJob.class); job.setMaxMapAttempts(1); // speed up failures - job.waitForCompletion(true); + job.submit(); + String trackingUrl = job.getTrackingURL(); + String jobId = job.getJobID().toString(); boolean succeeded = job.waitForCompletion(true); Assert.assertTrue(succeeded); Assert.assertEquals(JobStatus.State.SUCCEEDED, job.getJobState()); + Assert.assertTrue("Tracking URL was " + trackingUrl + + " but didn't Match Job ID " + jobId , + trackingUrl.endsWith(jobId.substring(jobId.lastIndexOf("_")) + "/")); verifySleepJobCounters(job); verifyTaskProgress(job); @@ -209,9 +214,15 @@ public void testRandomWriter() throws IOException, InterruptedException, job.addFileToClassPath(APP_JAR); // The AppMaster jar itself. job.setJarByClass(RandomTextWriterJob.class); job.setMaxMapAttempts(1); // speed up failures + job.submit(); + String trackingUrl = job.getTrackingURL(); + String jobId = job.getJobID().toString(); boolean succeeded = job.waitForCompletion(true); Assert.assertTrue(succeeded); Assert.assertEquals(JobStatus.State.SUCCEEDED, job.getJobState()); + Assert.assertTrue("Tracking URL was " + trackingUrl + + " but didn't Match Job ID " + jobId , + trackingUrl.endsWith(jobId.substring(jobId.lastIndexOf("_")) + "/")); // Make sure there are three files in the output-dir @@ -316,9 +327,14 @@ protected Job runFailingMapperJob() new Path(mrCluster.getTestWorkDir().getAbsolutePath(), "failmapper-output")); job.addFileToClassPath(APP_JAR); // The AppMaster jar itself. + job.submit(); + String trackingUrl = job.getTrackingURL(); + String jobId = job.getJobID().toString(); boolean succeeded = job.waitForCompletion(true); Assert.assertFalse(succeeded); - + Assert.assertTrue("Tracking URL was " + trackingUrl + + " but didn't Match Job ID " + jobId , + trackingUrl.endsWith(jobId.substring(jobId.lastIndexOf("_")) + "/")); return job; } @@ -360,8 +376,14 @@ public Void run() throws Exception { // //Job with reduces // Job job = sleepJob.createJob(3, 2, 10000, 1, 10000, 1); job.addFileToClassPath(APP_JAR); // The AppMaster jar itself. + job.submit(); + String trackingUrl = job.getTrackingURL(); + String jobId = job.getJobID().toString(); job.waitForCompletion(true); Assert.assertEquals(JobStatus.State.SUCCEEDED, job.getJobState()); + Assert.assertTrue("Tracking URL was " + trackingUrl + + " but didn't Match Job ID " + jobId , + trackingUrl.endsWith(jobId.substring(jobId.lastIndexOf("_")) + "/")); return null; } }); @@ -444,7 +466,12 @@ public void testDistributedCache() throws Exception { job.setMaxMapAttempts(1); // speed up failures job.submit(); + String trackingUrl = job.getTrackingURL(); + String jobId = job.getJobID().toString(); Assert.assertTrue(job.waitForCompletion(false)); + Assert.assertTrue("Tracking URL was " + trackingUrl + + " but didn't Match Job ID " + jobId , + trackingUrl.endsWith(jobId.substring(jobId.lastIndexOf("_")) + "/")); } private Path createTempFile(String filename, String contents)