Browse Source

MAPREDUCE-4595. TestLostTracker failing - possibly due to a race in JobHistory.JobHistoryFilesManager#run() (kkambatl via tucu)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1@1377895 13f79535-47bb-0310-9956-ffa450edef68
Alejandro Abdelnur 13 years ago
parent
commit
8e5605499b
2 changed files with 22 additions and 0 deletions
  1. 3 0
      CHANGES.txt
  2. 19 0
      src/test/org/apache/hadoop/mapred/TestLostTracker.java

+ 3 - 0
CHANGES.txt

@@ -210,6 +210,9 @@ Release 1.2.0 - unreleased
     HADOOP-4572. Can not access user logs - Jetty is not configured by default 
     HADOOP-4572. Can not access user logs - Jetty is not configured by default 
     to serve aliases/symlinks (ahmed via tucu)
     to serve aliases/symlinks (ahmed via tucu)
 
 
+    MAPREDUCE-4595. TestLostTracker failing - possibly due to a race in 
+    JobHistory.JobHistoryFilesManager#run() (kkambatl via tucu)
+
 Release 1.1.0 - unreleased
 Release 1.1.0 - unreleased
 
 
   INCOMPATIBLE CHANGES
   INCOMPATIBLE CHANGES

+ 19 - 0
src/test/org/apache/hadoop/mapred/TestLostTracker.java

@@ -101,6 +101,25 @@ public class TestLostTracker extends TestCase {
       testTaskStatuses(mtip.getTaskStatuses());
       testTaskStatuses(mtip.getTaskStatuses());
     }
     }
     
     
+    // Before validating job history, wait for the history file to be available
+    JobInProgress jip = mr.getJobTrackerRunner().getJobTracker().getJob(id);
+    long beginWaiting = System.currentTimeMillis();
+    final long MAX_WAIT_TIME = 5 * 60 * 1000;
+    while (System.currentTimeMillis() - beginWaiting < MAX_WAIT_TIME) {
+      if (!jip.getHistoryFile().equals("")) {
+        break;
+      } else {
+        try {
+          Thread.sleep(50);
+        } catch (InterruptedException ie) {
+          // do nothing
+        }
+      }
+    }
+
+    assertFalse("Job history file needs to be set for further validation", jip
+        .getHistoryFile().equals(""));
+
     // validate the history file
     // validate the history file
     TestJobHistory.validateJobHistoryFileFormat(id, job, "SUCCESS", true);
     TestJobHistory.validateJobHistoryFileFormat(id, job, "SUCCESS", true);
     TestJobHistory.validateJobHistoryFileContent(mr, rJob, job);
     TestJobHistory.validateJobHistoryFileContent(mr, rJob, job);