YARN-5925. Extract hbase-backend-exclusive utility methods from TimelineStorageUtil. Contributed by Haibo Chen.
This commit is contained in:
parent
8499299740
commit
2556c012e3
@ -30,7 +30,6 @@
|
||||
import org.apache.hadoop.yarn.server.timelineservice.reader.TimelineEntityFilters;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.reader.TimelineReaderContext;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.common.HBaseTimelineStorageUtils;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.common.TimelineStorageUtils;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.reader.EntityTypeReader;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.reader.TimelineEntityReader;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.reader.TimelineEntityReaderFactory;
|
||||
|
@ -48,7 +48,6 @@
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.common.LongKeyConverter;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.common.Separator;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.common.StringKeyConverter;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.common.TimelineStorageUtils;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.common.TypedBufferedMutator;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.entity.EntityColumn;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.entity.EntityColumnPrefix;
|
||||
|
@ -39,7 +39,6 @@
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.application.ApplicationTable;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.apptoflow.AppToFlowTable;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.common.HBaseTimelineStorageUtils;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.common.TimelineStorageUtils;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.entity.EntityTable;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.flow.FlowActivityTable;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.flow.FlowRunTable;
|
||||
|
@ -206,24 +206,6 @@ public static String getAggregationCompactionDimension(List<Tag> tags) {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public static boolean isFlowRunTable(HRegionInfo hRegionInfo,
|
||||
Configuration conf) {
|
||||
String regionTableName = hRegionInfo.getTable().getNameAsString();
|
||||
String flowRunTableName = conf.get(FlowRunTable.TABLE_NAME_CONF_NAME,
|
||||
FlowRunTable.DEFAULT_TABLE_NAME);
|
||||
if (HBaseTimelineStorageUtils.LOG.isDebugEnabled()) {
|
||||
HBaseTimelineStorageUtils.LOG.debug("regionTableName=" + regionTableName);
|
||||
}
|
||||
if (flowRunTableName.equalsIgnoreCase(regionTableName)) {
|
||||
if (HBaseTimelineStorageUtils.LOG.isDebugEnabled()) {
|
||||
HBaseTimelineStorageUtils.LOG.debug(
|
||||
"table is the flow run table!! " + flowRunTableName);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an int into it's inverse int to be used in (row) keys
|
||||
* where we want to have the largest int value in the top of the table
|
||||
@ -292,17 +274,16 @@ public static String convertApplicationIdToString(ApplicationId appId) {
|
||||
*/
|
||||
public static Configuration getTimelineServiceHBaseConf(Configuration conf)
|
||||
throws MalformedURLException {
|
||||
Configuration hbaseConf;
|
||||
|
||||
if (conf == null) {
|
||||
throw new NullPointerException();
|
||||
return HBaseConfiguration.create();
|
||||
}
|
||||
|
||||
Configuration hbaseConf;
|
||||
String timelineServiceHBaseConfFileURL =
|
||||
conf.get(YarnConfiguration.TIMELINE_SERVICE_HBASE_CONFIGURATION_FILE);
|
||||
if (timelineServiceHBaseConfFileURL != null
|
||||
&& timelineServiceHBaseConfFileURL.length() > 0) {
|
||||
LOG.info("Using hbase configuration at " +
|
||||
timelineServiceHBaseConfFileURL);
|
||||
// create a clone so that we don't mess with out input one
|
||||
hbaseConf = new Configuration(conf);
|
||||
Configuration plainHBaseConf = new Configuration(false);
|
||||
@ -349,4 +330,16 @@ public static byte[] calculateTheClosestNextRowKeyForPrefix(
|
||||
newStopRow[newStopRow.length - 1]++;
|
||||
return newStopRow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if passed object is of integral type(Short/Integer/Long).
|
||||
*
|
||||
* @param obj Object to be checked.
|
||||
* @return true if object passed is of type Short or Integer or Long, false
|
||||
* otherwise.
|
||||
*/
|
||||
public static boolean isIntegralValue(Object obj) {
|
||||
return (obj instanceof Short) || (obj instanceof Integer) ||
|
||||
(obj instanceof Long);
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public LongConverter() {
|
||||
|
||||
@Override
|
||||
public byte[] encodeValue(Object value) throws IOException {
|
||||
if (!TimelineStorageUtils.isIntegralValue(value)) {
|
||||
if (!HBaseTimelineStorageUtils.isIntegralValue(value)) {
|
||||
throw new IOException("Expected integral value");
|
||||
}
|
||||
return Bytes.toBytes(((Number)value).longValue());
|
||||
|
@ -33,7 +33,6 @@
|
||||
import org.apache.hadoop.yarn.server.timelineservice.reader.TimelineReaderContext;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.common.HBaseTimelineStorageUtils;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.common.Separator;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.common.TimelineStorageUtils;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.entity.EntityRowKey;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.entity.EntityRowKeyPrefix;
|
||||
import org.apache.hadoop.yarn.server.timelineservice.storage.entity.EntityTable;
|
||||
@ -154,8 +153,8 @@ private static byte[] getNextRowKey(byte[] currRowKeyPrefix,
|
||||
System.arraycopy(entityTypeEncoded, 0, currRowKey, currRowKeyPrefix.length,
|
||||
entityTypeEncoded.length);
|
||||
|
||||
return HBaseTimelineStorageUtils.
|
||||
calculateTheClosestNextRowKeyForPrefix(currRowKey);
|
||||
return HBaseTimelineStorageUtils.calculateTheClosestNextRowKeyForPrefix(
|
||||
currRowKey);
|
||||
}
|
||||
|
||||
private ResultScanner getResult(Configuration hbaseConf, Connection conn,
|
||||
|
Loading…
Reference in New Issue
Block a user