Forráskód Böngészése

HADOOP-649. Fix so that jobs with no tasks are not lost. Contributed by Thomas Friol.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@508583 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 18 éve
szülő
commit
fc86b40ce2

+ 3 - 0
CHANGES.txt

@@ -53,6 +53,9 @@ Trunk (unreleased changes)
     to track down a problem that was appearing as a
     NullPointerException.  (Dhruba Borthakur via cutting) 
 
+16. HADOOP-649.  Fix so that jobs with no tasks are not lost.
+    (Thomas Friol via cutting)
+
 
 Branch 0.11 (unreleased)
 

+ 3 - 0
src/java/org/apache/hadoop/mapred/JobInProgress.java

@@ -146,6 +146,9 @@ class JobInProgress {
         
         // if no split is returned, job is considered completed and successful
         if (numMapTasks == 0) {
+            // Finished time need to be setted here to prevent this job to be retired
+            // from the job tracker jobs at the next retire iteration.
+            this.finishTime = System.currentTimeMillis();
             this.status = new JobStatus(status.getJobId(), 1.0f, 1.0f, JobStatus.SUCCEEDED);
             tasksInited = true;
             return;

+ 9 - 0
src/test/org/apache/hadoop/mapred/TestEmptyJobWithDFS.java

@@ -92,6 +92,15 @@ public class TestEmptyJobWithDFS extends TestCase {
               break;
           }
       }
+      
+      try {
+          assertTrue(runningJob.isComplete());
+          assertTrue(runningJob.isSuccessful());
+      } catch (NullPointerException npe) {
+          // This NPE should no more happens
+          fail("A NPE should not have happened.");
+      }
+          
       // return job result
       LOG.info("job is complete: " + runningJob.isSuccessful());
       return (runningJob.isSuccessful());