http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/TimelineWriter.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/TimelineWriter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/TimelineWriter.java index 50136de..663a18a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/TimelineWriter.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/TimelineWriter.java @@ -42,12 +42,13 @@ public interface TimelineWriter extends Service { * @param userId context user ID * @param flowName context flow name * @param flowVersion context flow version - * @param flowRunId - * @param appId context app ID + * @param flowRunId run id for the flow. + * @param appId context app ID. * @param data * a {@link TimelineEntities} object. * @return a {@link TimelineWriteResponse} object. - * @throws IOException + * @throws IOException if there is any exception encountered while storing + * or writing entities to the backend storage. */ TimelineWriteResponse write(String clusterId, String userId, String flowName, String flowVersion, long flowRunId, String appId, @@ -65,8 +66,11 @@ public interface TimelineWriter extends Service { * a {@link TimelineEntity} object * a {@link TimelineAggregationTrack} enum * value. + * @param track Specifies the track or dimension along which aggregation would + * occur. Includes USER, FLOW, QUEUE, etc. * @return a {@link TimelineWriteResponse} object. - * @throws IOException + * @throws IOException if there is any exception encountered while aggregating + * entities to the backend storage. */ TimelineWriteResponse aggregate(TimelineEntity data, TimelineAggregationTrack track) throws IOException; @@ -76,7 +80,8 @@ public interface TimelineWriter extends Service { * written to the storage when the method returns. This may be a potentially * time-consuming operation, and should be used judiciously. * - * @throws IOException + * @throws IOException if there is any exception encountered while flushing + * entities to the backend storage. */ void flush() throws IOException; } \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/ApplicationColumn.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/ApplicationColumn.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/ApplicationColumn.java index c03c9b6..5734389 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/ApplicationColumn.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/ApplicationColumn.java @@ -34,7 +34,7 @@ import org.apache.hadoop.yarn.server.timelineservice.storage.flow.Attribute; public enum ApplicationColumn implements Column<ApplicationTable> { /** - * App id + * App id. */ ID(ApplicationColumnFamily.INFO, "id"), @@ -84,7 +84,7 @@ public enum ApplicationColumn implements Column<ApplicationTable> { /** * Retrieve an {@link ApplicationColumn} given a name, or null if there is no * match. The following holds true: {@code columnFor(x) == columnFor(y)} if - * and only if {@code x.equals(y)} or {@code (x == y == null)} + * and only if {@code x.equals(y)} or {@code (x == y == null)}. * * @param columnQualifier Name of the column to retrieve * @return the corresponding {@link ApplicationColumn} or null http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/ApplicationColumnPrefix.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/ApplicationColumnPrefix.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/ApplicationColumnPrefix.java index 056e51f..9120f3d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/ApplicationColumnPrefix.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/ApplicationColumnPrefix.java @@ -54,7 +54,7 @@ public enum ApplicationColumnPrefix implements ColumnPrefix<ApplicationTable> { INFO(ApplicationColumnFamily.INFO, "i"), /** - * Lifecycle events for an application + * Lifecycle events for an application. */ EVENT(ApplicationColumnFamily.INFO, "e"), @@ -214,7 +214,7 @@ public enum ApplicationColumnPrefix implements ColumnPrefix<ApplicationTable> { * is to facilitate returning byte arrays of values that were not * Strings. If they can be treated as Strings, you should use * {@link #readResults(Result)} instead. - * @throws IOException + * @throws IOException if any problem occurs while reading results. */ public Map<?, Object> readResultsHavingCompoundColumnQualifiers(Result result) throws IOException { @@ -276,8 +276,8 @@ public enum ApplicationColumnPrefix implements ColumnPrefix<ApplicationTable> { for (ApplicationColumnPrefix acp : ApplicationColumnPrefix.values()) { // Find a match based column family and on name. if (acp.columnFamily.equals(columnFamily) - && (((columnPrefix == null) && (acp.getColumnPrefix() == null)) || (acp - .getColumnPrefix().equals(columnPrefix)))) { + && (((columnPrefix == null) && (acp.getColumnPrefix() == null)) || + (acp.getColumnPrefix().equals(columnPrefix)))) { return acp; } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/ApplicationRowKey.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/ApplicationRowKey.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/ApplicationRowKey.java index 3c182b9..ad2aa7a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/ApplicationRowKey.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/ApplicationRowKey.java @@ -62,11 +62,11 @@ public class ApplicationRowKey { /** * Constructs a row key prefix for the application table as follows: - * {@code clusterId!userName!flowName!} + * {@code clusterId!userName!flowName!}. * - * @param clusterId - * @param userId - * @param flowName + * @param clusterId Cluster Id. + * @param userId User Id. + * @param flowName Flow Name. * @return byte array with the row key prefix */ public static byte[] getRowKeyPrefix(String clusterId, String userId, @@ -78,12 +78,12 @@ public class ApplicationRowKey { /** * Constructs a row key prefix for the application table as follows: - * {@code clusterId!userName!flowName!flowRunId!} + * {@code clusterId!userName!flowName!flowRunId!}. * - * @param clusterId - * @param userId - * @param flowName - * @param flowRunId + * @param clusterId Cluster Id. + * @param userId User Id. + * @param flowName Flow Name. + * @param flowRunId Run Id for the flow. * @return byte array with the row key prefix */ public static byte[] getRowKeyPrefix(String clusterId, String userId, @@ -96,13 +96,13 @@ public class ApplicationRowKey { /** * Constructs a row key for the application table as follows: - * {@code clusterId!userName!flowName!flowRunId!AppId} + * {@code clusterId!userName!flowName!flowRunId!AppId}. * - * @param clusterId - * @param userId - * @param flowName - * @param flowRunId - * @param appId + * @param clusterId Cluster Id. + * @param userId User Id. + * @param flowName Flow Name. + * @param flowRunId Run Id for the flow. + * @param appId App Id. * @return byte array with the row key */ public static byte[] getRowKey(String clusterId, String userId, @@ -119,6 +119,9 @@ public class ApplicationRowKey { /** * Given the raw row key as bytes, returns the row key as an object. + * + * @param rowKey Byte representation of row key. + * @return An <cite>ApplicationRowKey</cite> object. */ public static ApplicationRowKey parseRowKey(byte[] rowKey) { byte[][] rowKeyComponents = Separator.QUALIFIERS.split(rowKey); http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/ApplicationTable.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/ApplicationTable.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/ApplicationTable.java index 681c200..a02f768 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/ApplicationTable.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/ApplicationTable.java @@ -68,28 +68,28 @@ import org.apache.hadoop.yarn.server.timelineservice.storage.common.TimelineHBas * </pre> */ public class ApplicationTable extends BaseTable<ApplicationTable> { - /** application prefix */ + /** application prefix. */ private static final String PREFIX = YarnConfiguration.TIMELINE_SERVICE_PREFIX + ".application"; - /** config param name that specifies the application table name */ + /** config param name that specifies the application table name. */ public static final String TABLE_NAME_CONF_NAME = PREFIX + ".table.name"; /** * config param name that specifies the TTL for metrics column family in - * application table + * application table. */ private static final String METRICS_TTL_CONF_NAME = PREFIX + ".table.metrics.ttl"; - /** default value for application table name */ + /** default value for application table name. */ private static final String DEFAULT_TABLE_NAME = "timelineservice.application"; - /** default TTL is 30 days for metrics timeseries */ + /** default TTL is 30 days for metrics timeseries. */ private static final int DEFAULT_METRICS_TTL = 2592000; - /** default max number of versions */ + /** default max number of versions. */ private static final int DEFAULT_METRICS_MAX_VERSIONS = 1000; private static final Log LOG = LogFactory.getLog(ApplicationTable.class); @@ -139,8 +139,8 @@ public class ApplicationTable extends BaseTable<ApplicationTable> { metricsCF.setMaxVersions(DEFAULT_METRICS_MAX_VERSIONS); metricsCF.setTimeToLive(hbaseConf.getInt(METRICS_TTL_CONF_NAME, DEFAULT_METRICS_TTL)); - applicationTableDescp - .setRegionSplitPolicyClassName("org.apache.hadoop.hbase.regionserver.KeyPrefixRegionSplitPolicy"); + applicationTableDescp.setRegionSplitPolicyClassName( + "org.apache.hadoop.hbase.regionserver.KeyPrefixRegionSplitPolicy"); applicationTableDescp.setValue("KeyPrefixRegionSplitPolicy.prefix_length", TimelineHBaseSchemaConstants.USERNAME_SPLIT_KEY_PREFIX_LENGTH); admin.createTable(applicationTableDescp, http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/package-info.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/package-info.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/package-info.java index c60e6f5..eda14e6 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/package-info.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/application/package-info.java @@ -16,6 +16,10 @@ * limitations under the License. */ +/** + * Package org.apache.hadoop.yarn.server.timelineservice.storage.application + * contains classes related to implementation for application table. + */ @InterfaceAudience.Private @InterfaceStability.Unstable package org.apache.hadoop.yarn.server.timelineservice.storage.application; http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/AppToFlowColumn.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/AppToFlowColumn.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/AppToFlowColumn.java index 7f1ecaf..a8e1c66 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/AppToFlowColumn.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/AppToFlowColumn.java @@ -35,17 +35,17 @@ import java.io.IOException; public enum AppToFlowColumn implements Column<AppToFlowTable> { /** - * The flow ID + * The flow ID. */ FLOW_ID(AppToFlowColumnFamily.MAPPING, "flow_id"), /** - * The flow run ID + * The flow run ID. */ FLOW_RUN_ID(AppToFlowColumnFamily.MAPPING, "flow_run_id"), /** - * The user + * The user. */ USER_ID(AppToFlowColumnFamily.MAPPING, "user_id"); http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/AppToFlowColumnFamily.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/AppToFlowColumnFamily.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/AppToFlowColumnFamily.java index d722d15..f3f045e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/AppToFlowColumnFamily.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/AppToFlowColumnFamily.java @@ -26,7 +26,7 @@ import org.apache.hadoop.yarn.server.timelineservice.storage.common.Separator; */ public enum AppToFlowColumnFamily implements ColumnFamily<AppToFlowTable> { /** - * Mapping column family houses known columns such as flowName and flowRunId + * Mapping column family houses known columns such as flowName and flowRunId. */ MAPPING("m"); http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/AppToFlowRowKey.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/AppToFlowRowKey.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/AppToFlowRowKey.java index 133952e..3085bb1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/AppToFlowRowKey.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/AppToFlowRowKey.java @@ -43,10 +43,10 @@ public class AppToFlowRowKey { /** * Constructs a row key prefix for the app_flow table as follows: - * {@code clusterId!AppId} + * {@code clusterId!AppId}. * - * @param clusterId - * @param appId + * @param clusterId Cluster Id. + * @param appId Application Id. * @return byte array with the row key */ public static byte[] getRowKey(String clusterId, String appId) { @@ -57,6 +57,9 @@ public class AppToFlowRowKey { /** * Given the raw row key as bytes, returns the row key as an object. + * + * @param rowKey a rowkey represented as a byte array. + * @return an <cite>AppToFlowRowKey</cite> object. */ public static AppToFlowRowKey parseRowKey(byte[] rowKey) { byte[][] rowKeyComponents = Separator.QUALIFIERS.split(rowKey); http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/AppToFlowTable.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/AppToFlowTable.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/AppToFlowTable.java index 868c6f3..301cf99 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/AppToFlowTable.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/AppToFlowTable.java @@ -58,14 +58,14 @@ import java.io.IOException; * </pre> */ public class AppToFlowTable extends BaseTable<AppToFlowTable> { - /** app_flow prefix */ + /** app_flow prefix. */ private static final String PREFIX = YarnConfiguration.TIMELINE_SERVICE_PREFIX + "app-flow"; - /** config param name that specifies the app_flow table name */ + /** config param name that specifies the app_flow table name. */ public static final String TABLE_NAME_CONF_NAME = PREFIX + ".table.name"; - /** default value for app_flow table name */ + /** default value for app_flow table name. */ private static final String DEFAULT_TABLE_NAME = "timelineservice.app_flow"; private static final Log LOG = LogFactory.getLog(AppToFlowTable.class); http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/package-info.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/package-info.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/package-info.java index df7ffc1..f01d982 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/package-info.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/apptoflow/package-info.java @@ -15,6 +15,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +/** + * Package org.apache.hadoop.yarn.server.timelineservice.storage.apptoflow + * contains classes related to implementation for app to flow table. + */ @InterfaceAudience.Private @InterfaceStability.Unstable package org.apache.hadoop.yarn.server.timelineservice.storage.apptoflow; http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/BaseTable.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/BaseTable.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/BaseTable.java index 9545438..8581aa4 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/BaseTable.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/BaseTable.java @@ -39,7 +39,7 @@ import org.apache.hadoop.hbase.client.Table; public abstract class BaseTable<T> { /** - * Name of config variable that is used to point to this table + * Name of config variable that is used to point to this table. */ private final String tableNameConfName; @@ -52,6 +52,8 @@ public abstract class BaseTable<T> { /** * @param tableNameConfName name of config variable that is used to point to * this table. + * @param defaultTableName Default table name if table from config is not + * found. */ protected BaseTable(String tableNameConfName, String defaultTableName) { this.tableNameConfName = tableNameConfName; @@ -61,10 +63,11 @@ public abstract class BaseTable<T> { /** * Used to create a type-safe mutator for this table. * - * @param hbaseConf used to read table name + * @param hbaseConf used to read table name. * @param conn used to create a table from. * @return a type safe {@link BufferedMutator} for the entity table. - * @throws IOException + * @throws IOException if any exception occurs while creating mutator for the + * table. */ public TypedBufferedMutator<T> getTableMutator(Configuration hbaseConf, Connection conn) throws IOException { @@ -88,7 +91,7 @@ public abstract class BaseTable<T> { * @param conn used to create table from * @param scan that specifies what you want to read from this table. * @return scanner for the table. - * @throws IOException + * @throws IOException if any exception occurs while getting the scanner. */ public ResultScanner getResultScanner(Configuration hbaseConf, Connection conn, Scan scan) throws IOException { @@ -102,7 +105,7 @@ public abstract class BaseTable<T> { * @param conn used to create table from * @param get that specifies what single row you want to get from this table * @return result of get operation - * @throws IOException + * @throws IOException if any exception occurs while getting the result. */ public Result getResult(Configuration hbaseConf, Connection conn, Get get) throws IOException { @@ -113,7 +116,8 @@ public abstract class BaseTable<T> { /** * Get the table name for this table. * - * @param hbaseConf + * @param hbaseConf HBase configuration from which table name will be fetched. + * @return A {@link TableName} object. */ public TableName getTableName(Configuration hbaseConf) { TableName table = @@ -126,8 +130,9 @@ public abstract class BaseTable<T> { * Used to create the table in HBase. Should be called only once (per HBase * instance). * - * @param admin - * @param hbaseConf + * @param admin Used for doing HBase table operations. + * @param hbaseConf Hbase configuration. + * @throws IOException if any exception occurs while creating the table. */ public abstract void createTable(Admin admin, Configuration hbaseConf) throws IOException; http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/BufferedMutatorDelegator.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/BufferedMutatorDelegator.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/BufferedMutatorDelegator.java index fe8f9c6..cf469a5 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/BufferedMutatorDelegator.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/BufferedMutatorDelegator.java @@ -26,7 +26,7 @@ import org.apache.hadoop.hbase.client.BufferedMutator; import org.apache.hadoop.hbase.client.Mutation; /** - * To be used to wrap an actual {@link BufferedMutator} in a type safe manner + * To be used to wrap an actual {@link BufferedMutator} in a type safe manner. * * @param <T> The class referring to the table to be written to. */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/Column.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/Column.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/Column.java index 64c1cda..1f0b48f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/Column.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/Column.java @@ -19,7 +19,6 @@ package org.apache.hadoop.yarn.server.timelineservice.storage.common; import java.io.IOException; -import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.yarn.server.timelineservice.storage.flow.Attribute; @@ -39,25 +38,26 @@ public interface Column<T> { * column. * @param timestamp version timestamp. When null the server timestamp will be * used. - * @param attributes Map of attributes for this mutation. used in the coprocessor - * to set/read the cell tags. Can be null. + * @param attributes Map of attributes for this mutation. used in the + * coprocessor to set/read the cell tags. Can be null. * @param inputValue the value to write to the rowKey and column qualifier. * Nothing gets written when null. - * @throws IOException + * @throws IOException if there is any exception encountered during store. */ - public void store(byte[] rowKey, TypedBufferedMutator<T> tableMutator, + void store(byte[] rowKey, TypedBufferedMutator<T> tableMutator, Long timestamp, Object inputValue, Attribute... attributes) throws IOException; /** * Get the latest version of this specified column. Note: this call clones the - * value content of the hosting {@link Cell}. + * value content of the hosting {@link org.apache.hadoop.hbase.Cell Cell}. * * @param result Cannot be null * @return result object (can be cast to whatever object was written to), or * null when result doesn't contain this column. - * @throws IOException + * @throws IOException if there is any exception encountered while reading + * result. */ - public Object readResult(Result result) throws IOException; + Object readResult(Result result) throws IOException; } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/ColumnFamily.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/ColumnFamily.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/ColumnFamily.java index c84c016..452adcd 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/ColumnFamily.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/ColumnFamily.java @@ -29,6 +29,6 @@ public interface ColumnFamily<T> { * * @return a clone of the byte representation of the column family. */ - public byte[] getBytes(); + byte[] getBytes(); } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/ColumnHelper.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/ColumnHelper.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/ColumnHelper.java index 1e63ce5..15bb818 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/ColumnHelper.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/ColumnHelper.java @@ -26,7 +26,6 @@ import java.util.TreeMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.util.Bytes; @@ -82,7 +81,9 @@ public class ColumnHelper<T> { * @param inputValue * the value to write to the rowKey and column qualifier. Nothing * gets written when null. - * @throws IOException + * @param attributes Attributes to be set for HBase Put. + * @throws IOException if any problem occurs during store operation(sending + * mutation to table). */ public void store(byte[] rowKey, TypedBufferedMutator<?> tableMutator, byte[] columnQualifier, Long timestamp, Object inputValue, @@ -140,13 +141,13 @@ public class ColumnHelper<T> { /** * Get the latest version of this specified column. Note: this call clones the - * value content of the hosting {@link Cell}. + * value content of the hosting {@link org.apache.hadoop.hbase.Cell Cell}. * * @param result from which to read the value. Cannot be null * @param columnQualifierBytes referring to the column to be read. * @return latest version of the specified column of whichever object was * written. - * @throws IOException + * @throws IOException if any problem occurs while reading result. */ public Object readResult(Result result, byte[] columnQualifierBytes) throws IOException { @@ -167,9 +168,9 @@ public class ColumnHelper<T> { * columns are returned. * @param <V> the type of the values. The values will be cast into that type. * @return the cell values at each respective time in for form - * {idA={timestamp1->value1}, idA={timestamp2->value2}, - * idB={timestamp3->value3}, idC={timestamp1->value4}} - * @throws IOException + * {@literal {idA={timestamp1->value1}, idA={timestamp2->value2}, + * idB={timestamp3->value3}, idC={timestamp1->value4}}} + * @throws IOException if any problem occurs while reading results. */ @SuppressWarnings("unchecked") public <V> NavigableMap<String, NavigableMap<Long, V>> @@ -180,8 +181,9 @@ public class ColumnHelper<T> { new TreeMap<String, NavigableMap<Long, V>>(); if (result != null) { - NavigableMap<byte[], NavigableMap<byte[], NavigableMap<Long, byte[]>>> resultMap = - result.getMap(); + NavigableMap< + byte[], NavigableMap<byte[], NavigableMap<Long, byte[]>>> resultMap = + result.getMap(); NavigableMap<byte[], NavigableMap<Long, byte[]>> columnCellMap = resultMap.get(columnFamilyBytes); @@ -240,7 +242,7 @@ public class ColumnHelper<T> { * back and forth from Strings, you should use * {@link #readResultsHavingCompoundColumnQualifiers(Result, byte[])} * instead. - * @throws IOException + * @throws IOException if any problem occurs while reading results. */ public Map<String, Object> readResults(Result result, byte[] columnPrefixBytes) throws IOException { @@ -294,7 +296,7 @@ public class ColumnHelper<T> { * non-null column prefix bytes, the column qualifier is returned as * a list of parts, each part a byte[]. This is to facilitate * returning byte arrays of values that were not Strings. - * @throws IOException + * @throws IOException if any problem occurs while reading results. */ public Map<?, Object> readResultsHavingCompoundColumnQualifiers(Result result, byte[] columnPrefixBytes) throws IOException { http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/ColumnPrefix.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/ColumnPrefix.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/ColumnPrefix.java index 0f3ac4e..f221b31 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/ColumnPrefix.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/ColumnPrefix.java @@ -21,7 +21,6 @@ import java.io.IOException; import java.util.Map; import java.util.NavigableMap; -import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.yarn.server.timelineservice.storage.flow.Attribute; @@ -48,7 +47,8 @@ public interface ColumnPrefix<T> { * coprocessor to set/read the cell tags. * @param inputValue the value to write to the rowKey and column qualifier. * Nothing gets written when null. - * @throws IOException + * @throws IOException if there is any exception encountered while doing + * store operation(sending mutation to the table). */ void store(byte[] rowKey, TypedBufferedMutator<T> tableMutator, byte[] qualifier, Long timestamp, Object inputValue, @@ -69,7 +69,8 @@ public interface ColumnPrefix<T> { * coprocessor to set/read the cell tags. * @param inputValue the value to write to the rowKey and column qualifier. * Nothing gets written when null. - * @throws IOException + * @throws IOException if there is any exception encountered while doing + * store operation(sending mutation to the table). */ void store(byte[] rowKey, TypedBufferedMutator<T> tableMutator, String qualifier, Long timestamp, Object inputValue, @@ -77,14 +78,15 @@ public interface ColumnPrefix<T> { /** * Get the latest version of this specified column. Note: this call clones the - * value content of the hosting {@link Cell}. + * value content of the hosting {@link org.apache.hadoop.hbase.Cell Cell}. * * @param result Cannot be null * @param qualifier column qualifier. Nothing gets read when null. * @return result object (can be cast to whatever object was written to) or * null when specified column qualifier for this prefix doesn't exist * in the result. - * @throws IOException + * @throws IOException if there is any exception encountered while reading + * result. */ Object readResult(Result result, String qualifier) throws IOException; @@ -92,7 +94,8 @@ public interface ColumnPrefix<T> { * @param result from which to read columns * @return the latest values of columns in the column family with this prefix * (or all of them if the prefix value is null). - * @throws IOException + * @throws IOException if there is any exception encountered while reading + * results. */ Map<String, Object> readResults(Result result) throws IOException; @@ -100,9 +103,10 @@ public interface ColumnPrefix<T> { * @param result from which to reads data with timestamps * @param <V> the type of the values. The values will be cast into that type. * @return the cell values at each respective time in for form - * {idA={timestamp1->value1}, idA={timestamp2->value2}, - * idB={timestamp3->value3}, idC={timestamp1->value4}} - * @throws IOException + * {@literal {idA={timestamp1->value1}, idA={timestamp2->value2}, + * idB={timestamp3->value3}, idC={timestamp1->value4}}} + * @throws IOException if there is any exception encountered while reading + * result. */ <V> NavigableMap<String, NavigableMap<Long, V>> readResultsWithTimestamps(Result result) throws IOException; http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/LongConverter.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/LongConverter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/LongConverter.java index cdb8619..48c56f9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/LongConverter.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/LongConverter.java @@ -55,8 +55,9 @@ public final class LongConverter implements NumericValueConverter { /** * Compares two numbers as longs. If either number is null, it will be taken * as 0. - * @param num1 - * @param num2 + * + * @param num1 the first {@code Long} to compare. + * @param num2 the second {@code Long} to compare. * @return -1 if num1 is less than num2, 0 if num1 is equal to num2 and 1 if * num1 is greater than num2. */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/NumericValueConverter.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/NumericValueConverter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/NumericValueConverter.java index 70964cd..8fb6536 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/NumericValueConverter.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/NumericValueConverter.java @@ -29,9 +29,10 @@ public interface NumericValueConverter extends ValueConverter, /** * Adds two or more numbers. If either of the numbers are null, it is taken as * 0. - * @param num1 - * @param num2 - * @param numbers + * + * @param num1 the first number to add. + * @param num2 the second number to add. + * @param numbers Rest of the numbers to be added. * @return result after adding up the numbers. */ Number add(Number num1, Number num2, Number...numbers); http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/OfflineAggregationInfo.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/OfflineAggregationInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/OfflineAggregationInfo.java index 16c03a3..3dc5f51 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/OfflineAggregationInfo.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/OfflineAggregationInfo.java @@ -33,21 +33,24 @@ import java.sql.SQLException; */ public final class OfflineAggregationInfo { /** - * Default flow level aggregation table name + * Default flow level aggregation table name. */ @VisibleForTesting public static final String FLOW_AGGREGATION_TABLE_NAME = "yarn_timeline_flow_aggregation"; /** - * Default user level aggregation table name + * Default user level aggregation table name. */ public static final String USER_AGGREGATION_TABLE_NAME = "yarn_timeline_user_aggregation"; // These lists are not taking effects in table creations. - private static final String[] FLOW_AGGREGATION_PK_LIST = - { "user", "cluster", "flow_name" }; - private static final String[] USER_AGGREGATION_PK_LIST = { "user", "cluster"}; + private static final String[] FLOW_AGGREGATION_PK_LIST = { + "user", "cluster", "flow_name" + }; + private static final String[] USER_AGGREGATION_PK_LIST = { + "user", "cluster" + }; private final String tableName; private final String[] primaryKeyList; @@ -81,30 +84,32 @@ public final class OfflineAggregationInfo { public static final OfflineAggregationInfo FLOW_AGGREGATION = new OfflineAggregationInfo(FLOW_AGGREGATION_TABLE_NAME, - FLOW_AGGREGATION_PK_LIST, new PrimaryKeyStringSetter() { - @Override - public int setValues(PreparedStatement ps, - TimelineCollectorContext context, String[] extraInfo, int startPos) - throws SQLException { - int idx = startPos; - ps.setString(idx++, context.getUserId()); - ps.setString(idx++, context.getClusterId()); - ps.setString(idx++, context.getFlowName()); - return idx; - } - }); + FLOW_AGGREGATION_PK_LIST, + new PrimaryKeyStringSetter() { + @Override + public int setValues(PreparedStatement ps, + TimelineCollectorContext context, String[] extraInfo, + int startPos) throws SQLException { + int idx = startPos; + ps.setString(idx++, context.getUserId()); + ps.setString(idx++, context.getClusterId()); + ps.setString(idx++, context.getFlowName()); + return idx; + } + }); public static final OfflineAggregationInfo USER_AGGREGATION = new OfflineAggregationInfo(USER_AGGREGATION_TABLE_NAME, - USER_AGGREGATION_PK_LIST, new PrimaryKeyStringSetter() { - @Override - public int setValues(PreparedStatement ps, - TimelineCollectorContext context, String[] extraInfo, int startPos) - throws SQLException { - int idx = startPos; - ps.setString(idx++, context.getUserId()); - ps.setString(idx++, context.getClusterId()); - return idx; - } - }); + USER_AGGREGATION_PK_LIST, + new PrimaryKeyStringSetter() { + @Override + public int setValues(PreparedStatement ps, + TimelineCollectorContext context, String[] extraInfo, + int startPos) throws SQLException { + int idx = startPos; + ps.setString(idx++, context.getUserId()); + ps.setString(idx++, context.getClusterId()); + return idx; + } + }); } http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/Range.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/Range.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/Range.java index 2cb6c08..8a2e01a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/Range.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/Range.java @@ -20,6 +20,9 @@ package org.apache.hadoop.yarn.server.timelineservice.storage.common; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; +/** + * Encapsulates a range with start and end indices. + */ @InterfaceAudience.Private @InterfaceStability.Unstable public class Range { http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/Separator.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/Separator.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/Separator.java index 1e82494..a81c717 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/Separator.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/Separator.java @@ -30,7 +30,7 @@ import org.apache.hadoop.hbase.util.Bytes; public enum Separator { /** - * separator in key or column qualifier fields + * separator in key or column qualifier fields. */ QUALIFIERS("!", "%0$"), @@ -53,7 +53,7 @@ public enum Separator { private final String value; /** - * The URLEncoded version of this separator + * The URLEncoded version of this separator. */ private final String encodedValue; @@ -63,7 +63,7 @@ public enum Separator { private final byte[] bytes; /** - * The value quoted so that it can be used as a safe regex + * The value quoted so that it can be used as a safe regex. */ private final String quotedValue; @@ -99,7 +99,7 @@ public enum Separator { /** * Used to make token safe to be used with this separator without collisions. * - * @param token + * @param token Token to be encoded. * @return the token with any occurrences of this separator URLEncoded. */ public String encode(String token) { @@ -111,7 +111,9 @@ public enum Separator { } /** - * @param token + * Decode the token encoded using {@link #encode}. + * + * @param token Token to be decoded. * @return the token with any occurrences of the encoded separator replaced by * the separator itself. */ @@ -193,7 +195,7 @@ public enum Separator { * Returns a single byte array containing all of the individual arrays * components separated by this separator. * - * @param components + * @param components Byte array components to be joined together. * @return byte array after joining the components */ public byte[] join(byte[]... components) { @@ -287,8 +289,8 @@ public enum Separator { public Collection<String> splitEncoded(String compoundValue) { List<String> result = new ArrayList<String>(); if (compoundValue != null) { - for (String value : compoundValue.split(quotedValue)) { - result.add(decode(value)); + for (String val : compoundValue.split(quotedValue)) { + result.add(decode(val)); } } return result; @@ -298,6 +300,7 @@ public enum Separator { * Splits the source array into multiple array segments using this separator, * up to a maximum of count items. This will naturally produce copied byte * arrays for each of the split segments. + * * @param source to be split * @param limit on how many segments are supposed to be returned. A * non-positive value indicates no limit on number of segments. @@ -311,6 +314,7 @@ public enum Separator { * Splits the source array into multiple array segments using this separator, * as many times as splits are found. This will naturally produce copied byte * arrays for each of the split segments. + * * @param source to be split * @return source split by this separator. */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/TimelineHBaseSchemaConstants.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/TimelineHBaseSchemaConstants.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/TimelineHBaseSchemaConstants.java index bbf498a..8e6c259 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/TimelineHBaseSchemaConstants.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/TimelineHBaseSchemaConstants.java @@ -24,11 +24,13 @@ import org.apache.hadoop.hbase.util.Bytes; /** * contains the constants used in the context of schema accesses for * {@link org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity} - * information + * information. */ @InterfaceAudience.Private @InterfaceStability.Unstable -public class TimelineHBaseSchemaConstants { +public final class TimelineHBaseSchemaConstants { + private TimelineHBaseSchemaConstants() { + } /** * Used to create a pre-split for tables starting with a username in the @@ -36,27 +38,28 @@ public class TimelineHBaseSchemaConstants { * separators) so that different installations can presplit based on their own * commonly occurring names. */ - private final static byte[][] USERNAME_SPLITS = { Bytes.toBytes("a"), - Bytes.toBytes("ad"), Bytes.toBytes("an"), Bytes.toBytes("b"), - Bytes.toBytes("ca"), Bytes.toBytes("cl"), Bytes.toBytes("d"), - Bytes.toBytes("e"), Bytes.toBytes("f"), Bytes.toBytes("g"), - Bytes.toBytes("h"), Bytes.toBytes("i"), Bytes.toBytes("j"), - Bytes.toBytes("k"), Bytes.toBytes("l"), Bytes.toBytes("m"), - Bytes.toBytes("n"), Bytes.toBytes("o"), Bytes.toBytes("q"), - Bytes.toBytes("r"), Bytes.toBytes("s"), Bytes.toBytes("se"), - Bytes.toBytes("t"), Bytes.toBytes("u"), Bytes.toBytes("v"), - Bytes.toBytes("w"), Bytes.toBytes("x"), Bytes.toBytes("y"), - Bytes.toBytes("z") }; + private final static byte[][] USERNAME_SPLITS = { + Bytes.toBytes("a"), Bytes.toBytes("ad"), Bytes.toBytes("an"), + Bytes.toBytes("b"), Bytes.toBytes("ca"), Bytes.toBytes("cl"), + Bytes.toBytes("d"), Bytes.toBytes("e"), Bytes.toBytes("f"), + Bytes.toBytes("g"), Bytes.toBytes("h"), Bytes.toBytes("i"), + Bytes.toBytes("j"), Bytes.toBytes("k"), Bytes.toBytes("l"), + Bytes.toBytes("m"), Bytes.toBytes("n"), Bytes.toBytes("o"), + Bytes.toBytes("q"), Bytes.toBytes("r"), Bytes.toBytes("s"), + Bytes.toBytes("se"), Bytes.toBytes("t"), Bytes.toBytes("u"), + Bytes.toBytes("v"), Bytes.toBytes("w"), Bytes.toBytes("x"), + Bytes.toBytes("y"), Bytes.toBytes("z") + }; /** - * The length at which keys auto-split + * The length at which keys auto-split. */ public static final String USERNAME_SPLIT_KEY_PREFIX_LENGTH = "4"; /** * @return splits for splits where a user is a prefix. */ - public final static byte[][] getUsernameSplits() { + public static byte[][] getUsernameSplits() { byte[][] kloon = USERNAME_SPLITS.clone(); // Deep copy. for (int row = 0; row < USERNAME_SPLITS.length; row++) { http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/TimelineStorageUtils.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/TimelineStorageUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/TimelineStorageUtils.java index e30f699..2328bba 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/TimelineStorageUtils.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/TimelineStorageUtils.java @@ -45,15 +45,17 @@ import org.apache.hadoop.yarn.util.ConverterUtils; */ @Public @Unstable -public class TimelineStorageUtils { +public final class TimelineStorageUtils { + private TimelineStorageUtils() { + } - /** empty bytes */ + /** empty bytes. */ public static final byte[] EMPTY_BYTES = new byte[0]; - /** indicator for no limits for splitting */ + /** indicator for no limits for splitting. */ public static final int NO_LIMIT_SPLIT = -1; - /** milliseconds in one day */ + /** milliseconds in one day. */ public static final long MILLIS_ONE_DAY = 86400000L; /** @@ -62,9 +64,9 @@ public class TimelineStorageUtils { * copied byte arrays for each of the split segments. To identify the split * ranges without the array copies, see {@link #splitRanges(byte[], byte[])}. * - * @param source - * @param separator - * @return byte[] array after splitting the source + * @param source Source array. + * @param separator Separator represented as a byte array. + * @return byte[][] after splitting the source */ public static byte[][] split(byte[] source, byte[] separator) { return split(source, separator, NO_LIMIT_SPLIT); @@ -76,10 +78,10 @@ public class TimelineStorageUtils { * copied byte arrays for each of the split segments. To identify the split * ranges without the array copies, see {@link #splitRanges(byte[], byte[])}. * - * @param source - * @param separator + * @param source Source array. + * @param separator Separator represented as a byte array. * @param limit a non-positive value indicates no limit on number of segments. - * @return byte[][] after splitting the input source + * @return byte[][] after splitting the input source. */ public static byte[][] split(byte[] source, byte[] separator, int limit) { List<Range> segments = splitRanges(source, separator, limit); @@ -100,6 +102,10 @@ public class TimelineStorageUtils { * Returns a list of ranges identifying [start, end) -- closed, open -- * positions within the source byte array that would be split using the * separator byte array. + * + * @param source Source array. + * @param separator Separator represented as a byte array. + * @return a list of ranges. */ public static List<Range> splitRanges(byte[] source, byte[] separator) { return splitRanges(source, separator, NO_LIMIT_SPLIT); @@ -113,6 +119,7 @@ public class TimelineStorageUtils { * @param source the source data * @param separator the separator pattern to look for * @param limit the maximum number of splits to identify in the source + * @return a list of ranges. */ public static List<Range> splitRanges(byte[] source, byte[] separator, int limit) { @@ -132,7 +139,7 @@ public class TimelineStorageUtils { // everything else goes in one final segment break; } - segments.add(new Range(start, i)); + segments.add(new Range(start, i)); start = i + separator.length; // i will be incremented again in outer for loop i += separator.length - 1; @@ -219,9 +226,9 @@ public class TimelineStorageUtils { /** * returns the timestamp of that day's start (which is midnight 00:00:00 AM) - * for a given input timestamp + * for a given input timestamp. * - * @param ts + * @param ts Timestamp. * @return timestamp of that day's beginning (midnight) */ public static long getTopOfTheDayTimestamp(long ts) { @@ -233,9 +240,9 @@ public class TimelineStorageUtils { * Combines the input array of attributes and the input aggregation operation * into a new array of attributes. * - * @param attributes - * @param aggOp - * @return array of combined attributes + * @param attributes Attributes to be combined. + * @param aggOp Aggregation operation. + * @return array of combined attributes. */ public static Attribute[] combineAttributes(Attribute[] attributes, AggregationOperation aggOp) { @@ -257,8 +264,8 @@ public class TimelineStorageUtils { * Returns a number for the new array size. The new array is the combination * of input array of attributes and the input aggregation operation. * - * @param attributes - * @param aggOp + * @param attributes Attributes. + * @param aggOp Aggregation operation. * @return the size for the new array */ private static int getNewLengthCombinedAttributes(Attribute[] attributes, @@ -283,16 +290,17 @@ public class TimelineStorageUtils { } /** - * checks if an application has finished + * checks if an application has finished. * - * @param te + * @param te TimlineEntity object. * @return true if application has finished else false */ public static boolean isApplicationFinished(TimelineEntity te) { SortedSet<TimelineEvent> allEvents = te.getEvents(); if ((allEvents != null) && (allEvents.size() > 0)) { TimelineEvent event = allEvents.last(); - if (event.getId().equals(ApplicationMetricsConstants.FINISHED_EVENT_TYPE)) { + if (event.getId().equals( + ApplicationMetricsConstants.FINISHED_EVENT_TYPE)) { return true; } } @@ -300,26 +308,27 @@ public class TimelineStorageUtils { } /** - * get the time at which an app finished + * get the time at which an app finished. * - * @param te + * @param te TimelineEntity object. * @return true if application has finished else false */ public static long getApplicationFinishedTime(TimelineEntity te) { SortedSet<TimelineEvent> allEvents = te.getEvents(); if ((allEvents != null) && (allEvents.size() > 0)) { TimelineEvent event = allEvents.last(); - if (event.getId().equals(ApplicationMetricsConstants.FINISHED_EVENT_TYPE)) { + if (event.getId().equals( + ApplicationMetricsConstants.FINISHED_EVENT_TYPE)) { return event.getTimestamp(); } } - return 0l; + return 0L; } /** * Checks if the input TimelineEntity object is an ApplicationEntity. * - * @param te + * @param te TimelineEntity object. * @return true if input is an ApplicationEntity, false otherwise */ public static boolean isApplicationEntity(TimelineEntity te) { @@ -329,7 +338,7 @@ public class TimelineStorageUtils { /** * Checks for the APPLICATION_CREATED event. * - * @param te + * @param te TimelineEntity object. * @return true is application event exists, false otherwise */ public static boolean isApplicationCreated(TimelineEntity te) { @@ -346,9 +355,9 @@ public class TimelineStorageUtils { /** * Returns the first seen aggregation operation as seen in the list of input - * tags or null otherwise + * tags or null otherwise. * - * @param tags + * @param tags list of HBase tags. * @return AggregationOperation */ public static AggregationOperation getAggregationOperationFromTagsList( @@ -366,8 +375,8 @@ public class TimelineStorageUtils { /** * Creates a {@link Tag} from the input attribute. * - * @param attribute - * @return Tag + * @param attribute Attribute from which tag has to be fetched. + * @return a HBase Tag. */ public static Tag getTagFromAttribute(Entry<String, byte[]> attribute) { // attribute could be either an Aggregation Operation or @@ -380,8 +389,9 @@ public class TimelineStorageUtils { return t; } - AggregationCompactionDimension aggCompactDim = AggregationCompactionDimension - .getAggregationCompactionDimension(attribute.getKey()); + AggregationCompactionDimension aggCompactDim = + AggregationCompactionDimension.getAggregationCompactionDimension( + attribute.getKey()); if (aggCompactDim != null) { Tag t = new Tag(aggCompactDim.getTagType(), attribute.getValue()); return t; @@ -475,7 +485,8 @@ public class TimelineStorageUtils { /** * Checks if passed object is of integral type(Short/Integer/Long). - * @param obj + * + * @param obj Object to be checked. * @return true if object passed is of type Short or Integer or Long, false * otherwise. */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/TimestampGenerator.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/TimestampGenerator.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/TimestampGenerator.java index 555b64e..7238efa 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/TimestampGenerator.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/TimestampGenerator.java @@ -40,6 +40,8 @@ public class TimestampGenerator { /** * Returns the current wall clock time in milliseconds, multiplied by the * required precision. + * + * @return current timestamp. */ public long currentTime() { // We want to align cell timestamps with current time. @@ -58,6 +60,8 @@ public class TimestampGenerator { * sustained rate of more than 1M hbase writes per second AND if region fails * over within that time range of timestamps being generated then there may be * collisions writing to a cell version of the same column. + * + * @return unique timestamp. */ public long getUniqueTimestamp() { long lastTs; @@ -78,8 +82,8 @@ public class TimestampGenerator { * column at the same time, then say appId of 1001 will overlap with appId of * 001 and there may be collisions for that flow run's specific column. * - * @param incomingTS - * @param appId + * @param incomingTS Timestamp to be converted. + * @param appId Application Id. * @return a timestamp multiplied with TS_MULTIPLIER and last few digits of * application id */ @@ -101,9 +105,9 @@ public class TimestampGenerator { /** * truncates the last few digits of the timestamp which were supplemented by - * the TimestampGenerator#getSupplementedTimestamp function + * the TimestampGenerator#getSupplementedTimestamp function. * - * @param incomingTS + * @param incomingTS Timestamp to be truncated. * @return a truncated timestamp value */ public static long getTruncatedTimestamp(long incomingTS) { http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/ValueConverter.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/ValueConverter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/ValueConverter.java index 2388ba5..757a6d3 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/ValueConverter.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/common/ValueConverter.java @@ -28,18 +28,20 @@ public interface ValueConverter { /** * Encode an object as a byte array depending on the converter implementation. - * @param value + * + * @param value Value to be encoded. * @return a byte array - * @throws IOException + * @throws IOException if any problem is encountered while encoding. */ byte[] encodeValue(Object value) throws IOException; /** * Decode a byte array and convert it into an object depending on the * converter implementation. - * @param bytes + * + * @param bytes Byte array to be decoded. * @return an object - * @throws IOException + * @throws IOException if any problem is encountered while decoding. */ Object decodeValue(byte[] bytes) throws IOException; } http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/EntityColumn.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/EntityColumn.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/EntityColumn.java index deb8bd5..f47ba93 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/EntityColumn.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/EntityColumn.java @@ -39,7 +39,7 @@ public enum EntityColumn implements Column<EntityTable> { ID(EntityColumnFamily.INFO, "id"), /** - * The type of entity + * The type of entity. */ TYPE(EntityColumnFamily.INFO, "type"), http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/EntityColumnPrefix.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/EntityColumnPrefix.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/EntityColumnPrefix.java index 5b71228..f3c7e7f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/EntityColumnPrefix.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/EntityColumnPrefix.java @@ -54,7 +54,7 @@ public enum EntityColumnPrefix implements ColumnPrefix<EntityTable> { INFO(EntityColumnFamily.INFO, "i"), /** - * Lifecycle events for an entity + * Lifecycle events for an entity. */ EVENT(EntityColumnFamily.INFO, "e"), @@ -215,7 +215,8 @@ public enum EntityColumnPrefix implements ColumnPrefix<EntityTable> { * is to facilitate returning byte arrays of values that were not * Strings. If they can be treated as Strings, you should use * {@link #readResults(Result)} instead. - * @throws IOException + * @throws IOException if there is any exception encountered while reading + * result. */ public Map<?, Object> readResultsHavingCompoundColumnQualifiers(Result result) throws IOException { @@ -277,8 +278,8 @@ public enum EntityColumnPrefix implements ColumnPrefix<EntityTable> { for (EntityColumnPrefix ecp : EntityColumnPrefix.values()) { // Find a match based column family and on name. if (ecp.columnFamily.equals(columnFamily) - && (((columnPrefix == null) && (ecp.getColumnPrefix() == null)) || (ecp - .getColumnPrefix().equals(columnPrefix)))) { + && (((columnPrefix == null) && (ecp.getColumnPrefix() == null)) || + (ecp.getColumnPrefix().equals(columnPrefix)))) { return ecp; } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/EntityRowKey.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/EntityRowKey.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/EntityRowKey.java index 3eaa78c..04c633c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/EntityRowKey.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/EntityRowKey.java @@ -74,14 +74,14 @@ public class EntityRowKey { /** * Constructs a row key prefix for the entity table as follows: - * {@code userName!clusterId!flowName!flowRunId!AppId} + * {@code userName!clusterId!flowName!flowRunId!AppId}. * - * @param clusterId - * @param userId - * @param flowName - * @param flowRunId - * @param appId - * @return byte array with the row key prefix + * @param clusterId Context cluster id. + * @param userId User name. + * @param flowName Flow name. + * @param flowRunId Run Id for the flow. + * @param appId Application Id. + * @return byte array with the row key prefix. */ public static byte[] getRowKeyPrefix(String clusterId, String userId, String flowName, Long flowRunId, String appId) { @@ -97,15 +97,17 @@ public class EntityRowKey { /** * Constructs a row key prefix for the entity table as follows: - * {@code userName!clusterId!flowName!flowRunId!AppId!entityType!} + * {@code userName!clusterId!flowName!flowRunId!AppId!entityType!}. + * Typically used while querying multiple entities of a particular entity + * type. * - * @param clusterId - * @param userId - * @param flowName - * @param flowRunId - * @param appId - * @param entityType - * @return byte array with the row key prefix + * @param clusterId Context cluster id. + * @param userId User name. + * @param flowName Flow name. + * @param flowRunId Run Id for the flow. + * @param appId Application Id. + * @param entityType Entity type. + * @return byte array with the row key prefix. */ public static byte[] getRowKeyPrefix(String clusterId, String userId, String flowName, Long flowRunId, String appId, String entityType) { @@ -123,16 +125,17 @@ public class EntityRowKey { /** * Constructs a row key for the entity table as follows: - * {@code userName!clusterId!flowName!flowRunId!AppId!entityType!entityId} + * {@code userName!clusterId!flowName!flowRunId!AppId!entityType!entityId}. + * Typically used while querying a specific entity. * - * @param clusterId - * @param userId - * @param flowName - * @param flowRunId - * @param appId - * @param entityType - * @param entityId - * @return byte array with the row key + * @param clusterId Context cluster id. + * @param userId User name. + * @param flowName Flow name. + * @param flowRunId Run Id for the flow. + * @param appId Application Id. + * @param entityType Entity type. + * @param entityId Entity Id. + * @return byte array with the row key. */ public static byte[] getRowKey(String clusterId, String userId, String flowName, Long flowRunId, String appId, String entityType, @@ -151,6 +154,9 @@ public class EntityRowKey { /** * Given the raw row key as bytes, returns the row key as an object. + * + * @param rowKey byte representation of row key. + * @return An <cite>EntityRowKey</cite> object. */ public static EntityRowKey parseRowKey(byte[] rowKey) { byte[][] rowKeyComponents = Separator.QUALIFIERS.split(rowKey); http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/EntityTable.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/EntityTable.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/EntityTable.java index d7d770b..3e3e3ab 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/EntityTable.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/EntityTable.java @@ -69,27 +69,27 @@ import org.apache.hadoop.yarn.server.timelineservice.storage.common.TimelineHBas * </pre> */ public class EntityTable extends BaseTable<EntityTable> { - /** entity prefix */ + /** entity prefix. */ private static final String PREFIX = YarnConfiguration.TIMELINE_SERVICE_PREFIX + "entity"; - /** config param name that specifies the entity table name */ + /** config param name that specifies the entity table name. */ public static final String TABLE_NAME_CONF_NAME = PREFIX + ".table.name"; /** * config param name that specifies the TTL for metrics column family in - * entity table + * entity table. */ private static final String METRICS_TTL_CONF_NAME = PREFIX + ".table.metrics.ttl"; - /** default value for entity table name */ + /** default value for entity table name. */ private static final String DEFAULT_TABLE_NAME = "timelineservice.entity"; - /** default TTL is 30 days for metrics timeseries */ + /** default TTL is 30 days for metrics timeseries. */ private static final int DEFAULT_METRICS_TTL = 2592000; - /** default max number of versions */ + /** default max number of versions. */ private static final int DEFAULT_METRICS_MAX_VERSIONS = 1000; private static final Log LOG = LogFactory.getLog(EntityTable.class); @@ -139,8 +139,8 @@ public class EntityTable extends BaseTable<EntityTable> { metricsCF.setMaxVersions(DEFAULT_METRICS_MAX_VERSIONS); metricsCF.setTimeToLive(hbaseConf.getInt(METRICS_TTL_CONF_NAME, DEFAULT_METRICS_TTL)); - entityTableDescp - .setRegionSplitPolicyClassName("org.apache.hadoop.hbase.regionserver.KeyPrefixRegionSplitPolicy"); + entityTableDescp.setRegionSplitPolicyClassName( + "org.apache.hadoop.hbase.regionserver.KeyPrefixRegionSplitPolicy"); entityTableDescp.setValue("KeyPrefixRegionSplitPolicy.prefix_length", TimelineHBaseSchemaConstants.USERNAME_SPLIT_KEY_PREFIX_LENGTH); admin.createTable(entityTableDescp, http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/package-info.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/package-info.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/package-info.java index 26f1cc5..0e9578a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/package-info.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/entity/package-info.java @@ -16,6 +16,10 @@ * limitations under the License. */ +/** + * Package org.apache.hadoop.yarn.server.timelineservice.storage.entity + * contains classes related to implementation for entity table. + */ @InterfaceAudience.Private @InterfaceStability.Unstable package org.apache.hadoop.yarn.server.timelineservice.storage.entity; http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/AggregationCompactionDimension.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/AggregationCompactionDimension.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/AggregationCompactionDimension.java index ff12c7b..4e2cf2d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/AggregationCompactionDimension.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/AggregationCompactionDimension.java @@ -26,7 +26,7 @@ import org.apache.hadoop.hbase.util.Bytes; public enum AggregationCompactionDimension { /** - * the application id + * the application id. */ APPLICATION_ID((byte) 101); @@ -50,8 +50,8 @@ public enum AggregationCompactionDimension { return this.inBytes.clone(); } - public static AggregationCompactionDimension getAggregationCompactionDimension( - String aggCompactDimStr) { + public static AggregationCompactionDimension + getAggregationCompactionDimension(String aggCompactDimStr) { for (AggregationCompactionDimension aggDim : AggregationCompactionDimension .values()) { if (aggDim.name().equals(aggCompactDimStr)) { http://git-wip-us.apache.org/repos/asf/hadoop/blob/db76a3ad/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/AggregationOperation.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/AggregationOperation.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/AggregationOperation.java index c635ce6..6240e81 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/AggregationOperation.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/flow/AggregationOperation.java @@ -36,17 +36,17 @@ public enum AggregationOperation { MAX((byte) 73), /** - * The metrics of the flow + * The metrics of the flow. */ SUM((byte) 79), /** - * application running + * application running. */ SUM_FINAL((byte) 83), /** - * compact + * compact. */ COMPACT((byte) 89); @@ -71,8 +71,8 @@ public enum AggregationOperation { } /** - * returns the AggregationOperation enum that represents that string - * @param aggOpStr + * returns the AggregationOperation enum that represents that string. + * @param aggOpStr Aggregation operation. * @return the AggregationOperation enum that represents that string */ public static AggregationOperation getAggregationOperation(String aggOpStr) {