Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

JobHistory related clean-up #151

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ public class JobHistoryFileParserFactory {
* VERSION variable there becomes package-level visible and hence we need a replica
*/
public static final String HADOOP2_VERSION_STRING = "Avro-Json";
public static final String HADOOP1_VERSION_STRING = "Meta VERSION=\"1\" .";
private static final int HADOOP2_VERSION_LENGTH = 9;
private static final int HADOOP1_VERSION_LENGTH = 18;

/**
* determines the verison of hadoop that the history file belongs to
Expand All @@ -55,26 +53,17 @@ public static HadoopVersion getVersion(byte[] historyFileContents) {
String version2Part = new String(historyFileContents, 0, HADOOP2_VERSION_LENGTH);
if (StringUtils.equalsIgnoreCase(version2Part, HADOOP2_VERSION_STRING)) {
return HadoopVersion.TWO;
} else {
if(historyFileContents.length > HADOOP1_VERSION_LENGTH) {
// the first 18 bytes in a hadoop1.0 history file contain Meta VERSION="1" .
String version1Part = new String(historyFileContents, 0, HADOOP1_VERSION_LENGTH);
if (StringUtils.equalsIgnoreCase(version1Part, HADOOP1_VERSION_STRING)) {
return HadoopVersion.ONE;
}
}
}
}
// throw an exception if we did not find any matching version
throw new IllegalArgumentException(" Unknown format of job history file: " + historyFileContents);
}

/**
* creates an instance of {@link JobHistoryParseHadoop1}
* or
* {@link JobHistoryParseHadoop2} that can parse post MAPREDUCE-1016 job history files
* creates an instance of
* {@link JobHistoryFileParserHadoop2} that can parse post MAPREDUCE-1016 job history files
*
* @param historyFile: history file contents
* @param historyFileContents: history file contents
*
* @return an object that can parse job history files
* Or return null if either input is null
Expand All @@ -90,9 +79,6 @@ public static JobHistoryFileParser createJobHistoryFileParser(
HadoopVersion version = getVersion(historyFileContents);

switch (version) {
case ONE:
return new JobHistoryFileParserHadoop1(jobConf);

case TWO:
return new JobHistoryFileParserHadoop2(jobConf);

Expand All @@ -102,13 +88,6 @@ public static JobHistoryFileParser createJobHistoryFileParser(
}
}

/**
* @return HISTORY_FILE_VERSION1
*/
public static HadoopVersion getHistoryFileVersion1() {
return HadoopVersion.ONE;
}

/**
* @return HISTORY_FILE_VERSION2
*/
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,19 @@
import org.apache.avro.io.Decoder;
import org.apache.avro.io.DecoderFactory;
import org.apache.commons.configuration.ConversionException;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.mapred.JobHistoryCopy.RecordTypes;
import com.twitter.hraven.mapreduce.RecordTypes;
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;

import com.google.common.collect.Maps;
import com.twitter.hraven.AppKey;
import com.twitter.hraven.AppSummary;
import com.twitter.hraven.Constants;
import com.twitter.hraven.JobDetails;
import com.twitter.hraven.JobHistoryKeys;
Expand Down
Loading