Ver código fonte

HADOOP-3937. Limit the job name in the job history filename to 50
characters. (Matei Zaharia via omalley)


git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@690017 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley 17 anos atrás
pai
commit
2df7536763

+ 3 - 0
CHANGES.txt

@@ -239,6 +239,9 @@ Trunk (unreleased changes)
     HADOOP-3342. Change the kill task actions to require http post instead of 
     HADOOP-3342. Change the kill task actions to require http post instead of 
     get to prevent accidental crawls from triggering it. (enis via omalley)
     get to prevent accidental crawls from triggering it. (enis via omalley)
 
 
+    HADOOP-3937. Limit the job name in the job history filename to 50 
+    characters. (Matei Zaharia via omalley)
+
   OPTIMIZATIONS
   OPTIMIZATIONS
 
 
     HADOOP-3556. Removed lock contention in MD5Hash by changing the 
     HADOOP-3556. Removed lock contention in MD5Hash by changing the 

+ 6 - 1
src/mapred/org/apache/hadoop/mapred/JobHistory.java

@@ -71,6 +71,7 @@ public class JobHistory {
   
   
   public static final String JOBTRACKER_START_TIME =
   public static final String JOBTRACKER_START_TIME =
                                String.valueOf(System.currentTimeMillis());
                                String.valueOf(System.currentTimeMillis());
+  public static final int JOB_NAME_TRIM_LENGTH = 50;
   private static String JOBTRACKER_UNIQUE_STRING = null;
   private static String JOBTRACKER_UNIQUE_STRING = null;
   private static String LOG_DIR = null;
   private static String LOG_DIR = null;
   private static Map<String, ArrayList<PrintWriter>> openJobs = 
   private static Map<String, ArrayList<PrintWriter>> openJobs = 
@@ -449,9 +450,13 @@ public class JobHistory {
         }
         }
         
         
         // setup the history log file for this job
         // setup the history log file for this job
+        String trimmedJobName = jobName;
+        if (jobName.length() > JOB_NAME_TRIM_LENGTH) {
+          trimmedJobName = jobName.substring(0, JOB_NAME_TRIM_LENGTH);
+        }
         String logFileName = 
         String logFileName = 
             encodeJobHistoryFileName(jobUniqueString +  "_" + user + "_" + 
             encodeJobHistoryFileName(jobUniqueString +  "_" + user + "_" + 
-                                     jobName);
+                                     trimmedJobName);
 
 
         // find user log directory 
         // find user log directory 
         Path outputPath = FileOutputFormat.getOutputPath(jobConf);
         Path outputPath = FileOutputFormat.getOutputPath(jobConf);