瀏覽代碼

MAPREDUCE-5815. Fixed test-failure of TestMRAppMaster by making MRAppMaster gracefully handle empty-queue names. Contributed by Akira Ajisaka.
svn merge --ignore-ancestry -c 1586559 ../../trunk/


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2.4@1586561 13f79535-47bb-0310-9956-ffa450edef68

Vinod Kumar Vavilapalli 11 年之前
父節點
當前提交
0a00193574

+ 3 - 0
hadoop-mapreduce-project/CHANGES.txt

@@ -17,6 +17,9 @@ Release 2.4.1 - UNRELEASED
     MAPREDUCE-5824. Fixed test-failure of TestPipesNonJavaInputFormat in
     MAPREDUCE-5824. Fixed test-failure of TestPipesNonJavaInputFormat in
     Windows. (Xuan Gong via vinodkv)
     Windows. (Xuan Gong via vinodkv)
 
 
+    MAPREDUCE-5815. Fixed test-failure of TestMRAppMaster by making MRAppMaster
+    gracefully handle empty-queue names. (Akira Ajisaka via vinodkv)
+
 Release 2.4.0 - 2014-04-07 
 Release 2.4.0 - 2014-04-07 
 
 
   INCOMPATIBLE CHANGES
   INCOMPATIBLE CHANGES

+ 11 - 3
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java

@@ -40,6 +40,7 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.FileUtil;
 import org.apache.hadoop.fs.FileUtil;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.fs.permission.FsPermission;
+import org.apache.hadoop.mapred.JobConf;
 import org.apache.hadoop.mapreduce.Counter;
 import org.apache.hadoop.mapreduce.Counter;
 import org.apache.hadoop.mapreduce.Counters;
 import org.apache.hadoop.mapreduce.Counters;
 import org.apache.hadoop.mapreduce.JobCounter;
 import org.apache.hadoop.mapreduce.JobCounter;
@@ -442,8 +443,13 @@ public class JobHistoryEventHandler extends AbstractService
       }
       }
     }
     }
 
 
+    String queueName = JobConf.DEFAULT_QUEUE_NAME;
+    if (conf != null) {
+      queueName = conf.get(MRJobConfig.QUEUE_NAME, JobConf.DEFAULT_QUEUE_NAME);
+    }
+
     MetaInfo fi = new MetaInfo(historyFile, logDirConfPath, writer,
     MetaInfo fi = new MetaInfo(historyFile, logDirConfPath, writer,
-        user, jobName, jobId, forcedJobStateOnShutDown);
+        user, jobName, jobId, forcedJobStateOnShutDown, queueName);
     fi.getJobSummary().setJobId(jobId);
     fi.getJobSummary().setJobId(jobId);
     fileMap.put(jobId, fi);
     fileMap.put(jobId, fi);
   }
   }
@@ -816,12 +822,14 @@ public class JobHistoryEventHandler extends AbstractService
     private String forcedJobStateOnShutDown;
     private String forcedJobStateOnShutDown;
 
 
     MetaInfo(Path historyFile, Path conf, EventWriter writer, String user,
     MetaInfo(Path historyFile, Path conf, EventWriter writer, String user,
-        String jobName, JobId jobId, String forcedJobStateOnShutDown) {
+        String jobName, JobId jobId, String forcedJobStateOnShutDown,
+        String queueName) {
       this.historyFile = historyFile;
       this.historyFile = historyFile;
       this.confFile = conf;
       this.confFile = conf;
       this.writer = writer;
       this.writer = writer;
       this.jobIndexInfo =
       this.jobIndexInfo =
-          new JobIndexInfo(-1, -1, user, jobName, jobId, -1, -1, null);
+          new JobIndexInfo(-1, -1, user, jobName, jobId, -1, -1, null,
+                           queueName);
       this.jobSummary = new JobSummary();
       this.jobSummary = new JobSummary();
       this.flushTimer = new Timer("FlushTimer", true);
       this.flushTimer = new Timer("FlushTimer", true);
       this.forcedJobStateOnShutDown = forcedJobStateOnShutDown;
       this.forcedJobStateOnShutDown = forcedJobStateOnShutDown;

+ 5 - 1
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/jobhistory/FileNameIndexUtils.java

@@ -94,7 +94,7 @@ public class FileNameIndexUtils {
     sb.append(DELIMITER);
     sb.append(DELIMITER);
     
     
     //QueueName
     //QueueName
-    sb.append(escapeDelimiters(indexInfo.getQueueName()));
+    sb.append(escapeDelimiters(getQueueName(indexInfo)));
     sb.append(DELIMITER);
     sb.append(DELIMITER);
 
 
     //JobStartTime
     //JobStartTime
@@ -262,6 +262,10 @@ public class FileNameIndexUtils {
     return getNonEmptyString(indexInfo.getJobName());
     return getNonEmptyString(indexInfo.getJobName());
   }
   }
 
 
+  private static String getQueueName(JobIndexInfo indexInfo) {
+    return getNonEmptyString(indexInfo.getQueueName());
+  }
+
   //TODO Maybe handle default values for longs and integers here?
   //TODO Maybe handle default values for longs and integers here?
   
   
   private static String getNonEmptyString(String in) {
   private static String getNonEmptyString(String in) {

+ 11 - 2
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/jobhistory/JobIndexInfo.java

@@ -18,10 +18,11 @@
 
 
 package org.apache.hadoop.mapreduce.v2.jobhistory;
 package org.apache.hadoop.mapreduce.v2.jobhistory;
 
 
+import org.apache.hadoop.mapred.JobConf;
 import org.apache.hadoop.mapreduce.v2.api.records.JobId;
 import org.apache.hadoop.mapreduce.v2.api.records.JobId;
 
 
 /**
 /**
- * Maintains information which may be used by the jobHistroy indexing
+ * Maintains information which may be used by the jobHistory indexing
  * system.
  * system.
  */
  */
 public class JobIndexInfo {
 public class JobIndexInfo {
@@ -41,6 +42,13 @@ public class JobIndexInfo {
   
   
   public JobIndexInfo(long submitTime, long finishTime, String user,
   public JobIndexInfo(long submitTime, long finishTime, String user,
       String jobName, JobId jobId, int numMaps, int numReduces, String jobStatus) {
       String jobName, JobId jobId, int numMaps, int numReduces, String jobStatus) {
+    this(submitTime, finishTime, user, jobName, jobId, numMaps, numReduces,
+         jobStatus, JobConf.DEFAULT_QUEUE_NAME);
+  }
+
+  public JobIndexInfo(long submitTime, long finishTime, String user,
+                      String jobName, JobId jobId, int numMaps, int numReduces,
+                      String jobStatus, String queueName) {
     this.submitTime = submitTime;
     this.submitTime = submitTime;
     this.finishTime = finishTime;
     this.finishTime = finishTime;
     this.user = user;
     this.user = user;
@@ -50,8 +58,9 @@ public class JobIndexInfo {
     this.numReduces = numReduces;
     this.numReduces = numReduces;
     this.jobStatus = jobStatus;
     this.jobStatus = jobStatus;
     this.jobStartTime = -1;
     this.jobStartTime = -1;
+    this.queueName = queueName;
   }
   }
-  
+
   public long getSubmitTime() {
   public long getSubmitTime() {
     return submitTime;
     return submitTime;
   }
   }