|
@@ -32,8 +32,6 @@ import org.apache.hadoop.mapreduce.v2.api.records.JobId;
|
|
|
|
|
|
public class FileNameIndexUtils {
|
|
public class FileNameIndexUtils {
|
|
|
|
|
|
- static final int JOB_NAME_TRIM_LENGTH = 50;
|
|
|
|
-
|
|
|
|
// Sanitize job history file for predictable parsing
|
|
// Sanitize job history file for predictable parsing
|
|
static final String DELIMITER = "-";
|
|
static final String DELIMITER = "-";
|
|
static final String DELIMITER_ESCAPE = "%2D";
|
|
static final String DELIMITER_ESCAPE = "%2D";
|
|
@@ -60,6 +58,12 @@ public class FileNameIndexUtils {
|
|
* @return the done job history filename.
|
|
* @return the done job history filename.
|
|
*/
|
|
*/
|
|
public static String getDoneFileName(JobIndexInfo indexInfo) throws IOException {
|
|
public static String getDoneFileName(JobIndexInfo indexInfo) throws IOException {
|
|
|
|
+ return getDoneFileName(indexInfo,
|
|
|
|
+ JHAdminConfig.DEFAULT_MR_HS_JOBNAME_LIMIT);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static String getDoneFileName(JobIndexInfo indexInfo,
|
|
|
|
+ int jobNameLimit) throws IOException {
|
|
StringBuilder sb = new StringBuilder();
|
|
StringBuilder sb = new StringBuilder();
|
|
//JobId
|
|
//JobId
|
|
sb.append(escapeDelimiters(TypeConverter.fromYarn(indexInfo.getJobId()).toString()));
|
|
sb.append(escapeDelimiters(TypeConverter.fromYarn(indexInfo.getJobId()).toString()));
|
|
@@ -74,7 +78,8 @@ public class FileNameIndexUtils {
|
|
sb.append(DELIMITER);
|
|
sb.append(DELIMITER);
|
|
|
|
|
|
//JobName
|
|
//JobName
|
|
- sb.append(escapeDelimiters(trimJobName(getJobName(indexInfo))));
|
|
|
|
|
|
+ sb.append(escapeDelimiters(trimJobName(
|
|
|
|
+ getJobName(indexInfo), jobNameLimit)));
|
|
sb.append(DELIMITER);
|
|
sb.append(DELIMITER);
|
|
|
|
|
|
//FinishTime
|
|
//FinishTime
|
|
@@ -286,9 +291,9 @@ public class FileNameIndexUtils {
|
|
/**
|
|
/**
|
|
* Trims the job-name if required
|
|
* Trims the job-name if required
|
|
*/
|
|
*/
|
|
- private static String trimJobName(String jobName) {
|
|
|
|
- if (jobName.length() > JOB_NAME_TRIM_LENGTH) {
|
|
|
|
- jobName = jobName.substring(0, JOB_NAME_TRIM_LENGTH);
|
|
|
|
|
|
+ private static String trimJobName(String jobName, int jobNameLimit) {
|
|
|
|
+ if (jobName.length() > jobNameLimit) {
|
|
|
|
+ jobName = jobName.substring(0, jobNameLimit);
|
|
}
|
|
}
|
|
return jobName;
|
|
return jobName;
|
|
}
|
|
}
|