MAPREDUCE-6350. JobHistory doesn't support fully-functional search.
Contributed by Siqi Li.
This commit is contained in:
parent
48ca23def1
commit
6785661e55
|
@ -465,6 +465,9 @@ Release 2.8.0 - UNRELEASED
|
|||
MAPREDUCE-6388. Remove deprecation warnings from JobHistoryServer classes
|
||||
(Ray Chiang via ozawa).
|
||||
|
||||
MAPREDUCE-6350. JobHistory doesn't support fully-functional search.
|
||||
(Siqi Li via devaraj)
|
||||
|
||||
Release 2.7.1 - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -55,6 +55,7 @@ import org.apache.hadoop.mapreduce.v2.app.AppContext;
|
|||
import org.apache.hadoop.mapreduce.v2.app.job.Job;
|
||||
import org.apache.hadoop.mapreduce.v2.app.job.JobStateInternal;
|
||||
import org.apache.hadoop.mapreduce.v2.jobhistory.FileNameIndexUtils;
|
||||
import org.apache.hadoop.mapreduce.v2.jobhistory.JHAdminConfig;
|
||||
import org.apache.hadoop.mapreduce.v2.jobhistory.JobHistoryUtils;
|
||||
import org.apache.hadoop.mapreduce.v2.jobhistory.JobIndexInfo;
|
||||
import org.apache.hadoop.security.UserGroupInformation;
|
||||
|
@ -1107,9 +1108,12 @@ public class JobHistoryEventHandler extends AbstractService
|
|||
if (mi.getHistoryFile() != null) {
|
||||
Path historyFile = mi.getHistoryFile();
|
||||
Path qualifiedLogFile = stagingDirFS.makeQualified(historyFile);
|
||||
int jobNameLimit =
|
||||
getConfig().getInt(JHAdminConfig.MR_HS_JOBNAME_LIMIT,
|
||||
JHAdminConfig.DEFAULT_MR_HS_JOBNAME_LIMIT);
|
||||
String doneJobHistoryFileName =
|
||||
getTempFileName(FileNameIndexUtils.getDoneFileName(mi
|
||||
.getJobIndexInfo()));
|
||||
.getJobIndexInfo(), jobNameLimit));
|
||||
qualifiedDoneFile =
|
||||
doneDirFS.makeQualified(new Path(doneDirPrefixPath,
|
||||
doneJobHistoryFileName));
|
||||
|
|
|
@ -32,8 +32,6 @@ import org.apache.hadoop.mapreduce.v2.api.records.JobId;
|
|||
|
||||
public class FileNameIndexUtils {
|
||||
|
||||
static final int JOB_NAME_TRIM_LENGTH = 50;
|
||||
|
||||
// Sanitize job history file for predictable parsing
|
||||
static final String DELIMITER = "-";
|
||||
static final String DELIMITER_ESCAPE = "%2D";
|
||||
|
@ -60,6 +58,12 @@ public class FileNameIndexUtils {
|
|||
* @return the done job history filename.
|
||||
*/
|
||||
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();
|
||||
//JobId
|
||||
sb.append(escapeDelimiters(TypeConverter.fromYarn(indexInfo.getJobId()).toString()));
|
||||
|
@ -74,7 +78,8 @@ public class FileNameIndexUtils {
|
|||
sb.append(DELIMITER);
|
||||
|
||||
//JobName
|
||||
sb.append(escapeDelimiters(trimJobName(getJobName(indexInfo))));
|
||||
sb.append(escapeDelimiters(trimJobName(
|
||||
getJobName(indexInfo), jobNameLimit)));
|
||||
sb.append(DELIMITER);
|
||||
|
||||
//FinishTime
|
||||
|
@ -286,9 +291,9 @@ public class FileNameIndexUtils {
|
|||
/**
|
||||
* 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;
|
||||
}
|
||||
|
|
|
@ -214,4 +214,11 @@ public class JHAdminConfig {
|
|||
*/
|
||||
public static boolean DEFAULT_MR_HISTORY_MINICLUSTER_FIXED_PORTS = false;
|
||||
|
||||
/**
|
||||
* Number of characters allowed for job name in Job History Server web page.
|
||||
*/
|
||||
public static final String MR_HS_JOBNAME_LIMIT = MR_HISTORY_PREFIX
|
||||
+ "jobname.limit";
|
||||
public static final int DEFAULT_MR_HS_JOBNAME_LIMIT = 50;
|
||||
|
||||
}
|
||||
|
|
|
@ -147,6 +147,32 @@ public class TestFileNameIndexUtils {
|
|||
jobHistoryFile.contains(USER_NAME_WITH_DELIMITER_ESCAPE));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTrimJobName() throws IOException {
|
||||
int jobNameTrimLength = 5;
|
||||
JobIndexInfo info = new JobIndexInfo();
|
||||
JobID oldJobId = JobID.forName(JOB_ID);
|
||||
JobId jobId = TypeConverter.toYarn(oldJobId);
|
||||
info.setJobId(jobId);
|
||||
info.setSubmitTime(Long.parseLong(SUBMIT_TIME));
|
||||
info.setUser(USER_NAME);
|
||||
info.setJobName(JOB_NAME);
|
||||
info.setFinishTime(Long.parseLong(FINISH_TIME));
|
||||
info.setNumMaps(Integer.parseInt(NUM_MAPS));
|
||||
info.setNumReduces(Integer.parseInt(NUM_REDUCES));
|
||||
info.setJobStatus(JOB_STATUS);
|
||||
info.setQueueName(QUEUE_NAME);
|
||||
info.setJobStartTime(Long.parseLong(JOB_START_TIME));
|
||||
|
||||
String jobHistoryFile =
|
||||
FileNameIndexUtils.getDoneFileName(info, jobNameTrimLength);
|
||||
JobIndexInfo parsedInfo = FileNameIndexUtils.getIndexInfo(jobHistoryFile);
|
||||
|
||||
Assert.assertEquals("Job name did not get trimmed correctly",
|
||||
info.getJobName().substring(0, jobNameTrimLength),
|
||||
parsedInfo.getJobName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUserNamePercentDecoding() throws IOException {
|
||||
String jobHistoryFile = String.format(JOB_HISTORY_FILE_FORMATTER,
|
||||
|
|
|
@ -1705,6 +1705,14 @@
|
|||
</description>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>mapreduce.jobhistory.jobname.limit</name>
|
||||
<value>50</value>
|
||||
<description>
|
||||
Number of characters allowed for job name in Job History Server web page.
|
||||
</description>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>mapreduce.job.heap.memory-mb.ratio</name>
|
||||
<value>0.8</value>
|
||||
|
|
Loading…
Reference in New Issue