Class Append

All Implemented Interfaces:
Comparable<Row>, CellScannable, Attributes, Row, HeapSize

@Public public class Append extends Mutation
Performs Append operations on a single row.

This operation ensures atomicty to readers. Appends are done under a single row lock, so write operations to a row are synchronized, and readers are guaranteed to see this operation fully completed.

To append to a set of columns of a row, instantiate an Append object with the row to append to. At least one column to append must be specified using the addColumn(byte[], byte[], byte[]) method.

  • Field Details

  • Constructor Details

    • Append

      public Append(byte[] row)
      Create a Append operation for the specified row.

      At least one column must be appended to.

      Parameters:
      row - row key; makes a local copy of passed in array.
    • Append

      public Append(Append appendToCopy)
      Copy constructor
      Parameters:
      appendToCopy - append to copy
    • Append

      public Append(byte[] rowArray, int rowOffset, int rowLength)
      Create a Append operation for the specified row.

      At least one column must be appended to.

      Parameters:
      rowArray - Makes a copy out of this buffer.
    • Append

      public Append(byte[] row, long ts, NavigableMap<byte[],List<Cell>> familyMap)
      Construct the Append with user defined data. NOTED: 1) all cells in the familyMap must have the Type.Put 2) the row of each cell must be same with passed row.
      Parameters:
      row - row. CAN'T be null
      ts - timestamp
      familyMap - the map to collect all cells internally. CAN'T be null
  • Method Details

    • setTimeRange

      public Append setTimeRange(long minStamp, long maxStamp)
      Sets the TimeRange to be used on the Get for this append.

      This is useful for when you have counters that only last for specific periods of time (ie. counters that are partitioned by time). By setting the range of valid times for this append, you can potentially gain some performance with a more optimal Get operation. Be careful adding the time range to this class as you will update the old cell if the time range doesn't include the latest cells.

      This range is used as [minStamp, maxStamp).

      Parameters:
      minStamp - minimum timestamp value, inclusive
      maxStamp - maximum timestamp value, exclusive
    • getTimeRange

      Gets the TimeRange used for this append.
    • extraHeapSize

      protected long extraHeapSize()
      Description copied from class: Mutation
      Subclasses should override this method to add the heap size of their own fields.
      Overrides:
      extraHeapSize in class Mutation
      Returns:
      the heap size to add (will be aligned).
    • setReturnResults

      public Append setReturnResults(boolean returnResults)
      True (default) if the append operation should return the results. A client that is not interested in the result can save network bandwidth setting this to false.
      Overrides:
      setReturnResults in class Mutation
    • isReturnResults

      public boolean isReturnResults()
      Returns current setting for returnResults
      Overrides:
      isReturnResults in class Mutation
    • add

      @Deprecated public Append add(byte[] family, byte[] qualifier, byte[] value)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0. Use addColumn(byte[], byte[], byte[]) instead
      Add the specified column and value to this Append operation.
      Parameters:
      family - family name
      qualifier - column qualifier
      value - value to append to specified column
    • addColumn

      public Append addColumn(byte[] family, byte[] qualifier, byte[] value)
      Add the specified column and value to this Append operation.
      Parameters:
      family - family name
      qualifier - column qualifier
      value - value to append to specified column
    • add

      public Append add(Cell cell)
      Add column and value to this Append operation.
      Overrides:
      add in class Mutation
      Returns:
      This instance
    • setTimestamp

      public Append setTimestamp(long timestamp)
      Description copied from class: Mutation
      Set the timestamp of the delete.
      Overrides:
      setTimestamp in class Mutation
    • setAttribute

      public Append setAttribute(String name, byte[] value)
      Description copied from interface: Attributes
      Sets an attribute. In case value = null attribute is removed from the attributes map. Attribute names starting with _ indicate system attributes.
      Specified by:
      setAttribute in interface Attributes
      Overrides:
      setAttribute in class OperationWithAttributes
      Parameters:
      name - attribute name
      value - attribute value
    • setId

      public Append setId(String id)
      Description copied from class: OperationWithAttributes
      This method allows you to set an identifier on an operation. The original motivation for this was to allow the identifier to be used in slow query logging, but this could obviously be useful in other places. One use of this could be to put a class.method identifier in here to see where the slow query is coming from. id to set for the scan
      Overrides:
      setId in class OperationWithAttributes
    • setDurability

      Description copied from class: Mutation
      Set the durability for this mutation
      Overrides:
      setDurability in class Mutation
    • setFamilyCellMap

      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0. Use Append(byte[], long, NavigableMap) instead
      Method for setting the Append's familyMap
      Overrides:
      setFamilyCellMap in class Mutation
    • setClusterIds

      public Append setClusterIds(List<UUID> clusterIds)
      Description copied from class: Mutation
      Marks that the clusters with the given clusterIds have consumed the mutation
      Overrides:
      setClusterIds in class Mutation
      Parameters:
      clusterIds - of the clusters that have consumed the mutation
    • setCellVisibility

      Description copied from class: Mutation
      Sets the visibility expression associated with cells in this Mutation.
      Overrides:
      setCellVisibility in class Mutation
    • setACL

      public Append setACL(String user, Permission perms)
      Description copied from class: Mutation
      Set the ACL for this operation.
      Overrides:
      setACL in class Mutation
      Parameters:
      user - User short name
      perms - Permissions for the user
    • setACL

      public Append setACL(Map<String,Permission> perms)
      Description copied from class: Mutation
      Set the ACL for this operation.
      Overrides:
      setACL in class Mutation
      Parameters:
      perms - A map of permissions for a user or users
    • setPriority

      public Append setPriority(int priority)
      Overrides:
      setPriority in class OperationWithAttributes
    • setTTL

      public Append setTTL(long ttl)
      Description copied from class: Mutation
      Set the TTL desired for the result of the mutation, in milliseconds.
      Overrides:
      setTTL in class Mutation
      Parameters:
      ttl - the TTL desired for the result of the mutation, in milliseconds