Class HBaseTimelineServerUtils

java.lang.Object
org.apache.hadoop.yarn.server.timelineservice.storage.common.HBaseTimelineServerUtils

public final class HBaseTimelineServerUtils extends Object
A utility class used by hbase-server module.
  • Method Summary

    Modifier and Type
    Method
    Description
    static List<org.apache.hadoop.hbase.Tag>
    convertCellAsTagList(org.apache.hadoop.hbase.Cell cell)
    Convert a cell to a list of tags.
    static byte[]
    convertTagListToByteArray(List<org.apache.hadoop.hbase.Tag> tags)
    Convert a list of tags to a byte array.
    static org.apache.hadoop.hbase.Cell
    createNewCell(byte[] row, byte[] family, byte[] qualifier, long ts, byte[] newValue, byte[] tags)
    creates a cell with the given inputs.
    static org.apache.hadoop.hbase.Cell
    createNewCell(org.apache.hadoop.hbase.Cell origCell, byte[] newValue)
    creates a new cell based on the input cell but with the new value.
    static org.apache.hadoop.hbase.Tag
    createTag(byte tagType, byte[] tag)
    Create a Tag.
    static org.apache.hadoop.hbase.Tag
    createTag(byte tagType, String tag)
    Create a Tag.
    static int
    flushCompactTableRegions(org.apache.hadoop.hbase.regionserver.HRegionServer server, org.apache.hadoop.hbase.TableName table)
    Flush and compact all regions of a table.
    static String
    getAggregationCompactionDimension(List<org.apache.hadoop.hbase.Tag> tags)
    returns app id from the list of tags.
    static org.apache.hadoop.yarn.server.timelineservice.storage.flow.AggregationOperation
    getAggregationOperationFromTagsList(List<org.apache.hadoop.hbase.Tag> tags)
    Returns the first seen aggregation operation as seen in the list of input tags or null otherwise.
    static org.apache.hadoop.hbase.Tag
    Creates a Tag from the input attribute.
    static void
    validateFlowRunCoprocessor(org.apache.hadoop.hbase.regionserver.HRegionServer server, org.apache.hadoop.hbase.TableName table, boolean existenceExpected)
    Check the existence of FlowRunCoprocessor in a table.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getTagFromAttribute

      public static org.apache.hadoop.hbase.Tag getTagFromAttribute(Map.Entry<String,byte[]> attribute)
      Creates a Tag from the input attribute.
      Parameters:
      attribute - Attribute from which tag has to be fetched.
      Returns:
      a HBase Tag.
    • createNewCell

      public static org.apache.hadoop.hbase.Cell createNewCell(org.apache.hadoop.hbase.Cell origCell, byte[] newValue) throws IOException
      creates a new cell based on the input cell but with the new value.
      Parameters:
      origCell - Original cell
      newValue - new cell value
      Returns:
      cell
      Throws:
      IOException - while creating new cell.
    • createNewCell

      public static org.apache.hadoop.hbase.Cell createNewCell(byte[] row, byte[] family, byte[] qualifier, long ts, byte[] newValue, byte[] tags) throws IOException
      creates a cell with the given inputs.
      Parameters:
      row - row of the cell to be created
      family - column family name of the new cell
      qualifier - qualifier for the new cell
      ts - timestamp of the new cell
      newValue - value of the new cell
      tags - tags in the new cell
      Returns:
      cell
      Throws:
      IOException - while creating the cell.
    • createTag

      public static org.apache.hadoop.hbase.Tag createTag(byte tagType, byte[] tag)
      Create a Tag.
      Parameters:
      tagType - tag type
      tag - the content of the tag in byte array.
      Returns:
      an instance of Tag
    • createTag

      public static org.apache.hadoop.hbase.Tag createTag(byte tagType, String tag)
      Create a Tag.
      Parameters:
      tagType - tag type
      tag - the content of the tag in String.
      Returns:
      an instance of Tag
    • convertCellAsTagList

      public static List<org.apache.hadoop.hbase.Tag> convertCellAsTagList(org.apache.hadoop.hbase.Cell cell)
      Convert a cell to a list of tags.
      Parameters:
      cell - the cell to convert
      Returns:
      a list of tags
    • convertTagListToByteArray

      public static byte[] convertTagListToByteArray(List<org.apache.hadoop.hbase.Tag> tags)
      Convert a list of tags to a byte array.
      Parameters:
      tags - the list of tags to convert
      Returns:
      byte array representation of the list of tags
    • getAggregationCompactionDimension

      public static String getAggregationCompactionDimension(List<org.apache.hadoop.hbase.Tag> tags)
      returns app id from the list of tags.
      Parameters:
      tags - cell tags to be looked into
      Returns:
      App Id as the AggregationCompactionDimension
    • getAggregationOperationFromTagsList

      public static org.apache.hadoop.yarn.server.timelineservice.storage.flow.AggregationOperation getAggregationOperationFromTagsList(List<org.apache.hadoop.hbase.Tag> tags)
      Returns the first seen aggregation operation as seen in the list of input tags or null otherwise.
      Parameters:
      tags - list of HBase tags.
      Returns:
      AggregationOperation
    • flushCompactTableRegions

      public static int flushCompactTableRegions(org.apache.hadoop.hbase.regionserver.HRegionServer server, org.apache.hadoop.hbase.TableName table) throws IOException
      Flush and compact all regions of a table.
      Parameters:
      server - region server
      table - the table to flush and compact
      Returns:
      the number of regions flushed and compacted
      Throws:
      IOException - any IOE raised, or translated exception.
    • validateFlowRunCoprocessor

      public static void validateFlowRunCoprocessor(org.apache.hadoop.hbase.regionserver.HRegionServer server, org.apache.hadoop.hbase.TableName table, boolean existenceExpected) throws Exception
      Check the existence of FlowRunCoprocessor in a table.
      Parameters:
      server - region server
      table - table to check
      existenceExpected - true if the FlowRunCoprocessor is expected to be loaded in the table, false otherwise
      Throws:
      Exception - Exception if any.