Explorar el Código

MAPREDUCE-3837. Job tracker is not able to recover jobs after crash. Contributed by Mayank Bansal.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.22@1243700 13f79535-47bb-0310-9956-ffa450edef68
Konstantin Shvachko hace 13 años
padre
commit
de7c90ff17

+ 3 - 0
mapreduce/CHANGES.txt

@@ -20,6 +20,9 @@ Release 0.22.1 - Unreleased
     MAPREDUCE-3725. hadoop job -list returns user name as NULL.
     (Mayank Bansal via shv)
 
+    MAPREDUCE-3837. Job tracker is not able to recover jobs after crash.
+    (Mayank Bansal via shv) 
+
 Release 0.22.0 - 2011-11-29
 
   INCOMPATIBLE CHANGES

+ 8 - 4
mapreduce/src/java/org/apache/hadoop/mapred/JobTracker.java

@@ -1167,13 +1167,17 @@ public class JobTracker implements MRConstants, InterTrackerProtocol,
         try {
           Path jobInfoFile = getSystemFileForJob(jobId);
           FSDataInputStream in = fs.open(jobInfoFile);
-          JobInfo token = new JobInfo();
+          final JobInfo token = new JobInfo();
           token.readFields(in);
           in.close();
-          UserGroupInformation ugi = 
+          final UserGroupInformation ugi = 
             UserGroupInformation.createRemoteUser(token.getUser().toString());
-          submitJob(token.getJobID(), restartCount, 
-              ugi, token.getJobSubmitDir().toString(), true, null);
+          ugi.doAs(new PrivilegedExceptionAction<JobStatus>() {
+          public JobStatus run() throws IOException ,InterruptedException{
+        	  return submitJob(token.getJobID(), restartCount, 
+        			  	ugi, token.getJobSubmitDir().toString(), true, null);
+          }});
+
           recovered++;
         } catch (Exception e) {
           LOG.warn("Could not recover job " + jobId, e);