org.apache.hadoop.hbase.regionserver.wal
Class HLogKey

java.lang.Object
  extended by org.apache.hadoop.hbase.regionserver.wal.HLogKey
All Implemented Interfaces:
Comparable<HLogKey>, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable<HLogKey>

@InterfaceAudience.Private
public class HLogKey
extends Object
implements org.apache.hadoop.io.WritableComparable<HLogKey>

A Key for an entry in the change log. The log intermingles edits to many tables and rows, so each log entry identifies the appropriate table and row. Within a table and row, they're also sorted.

Some Transactional edits (START, COMMIT, ABORT) will not have an associated row.


Field Summary
static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
HLogKey()
           
HLogKey(byte[] encodedRegionName, TableName tablename, long logSeqNum, long now, UUID clusterId)
          Create the log key for writing to somewhere.
HLogKey(WALProtos.WALKey walKey)
          Create HLogKey wrapper around protobuf WAL key; takes care of compression.
 
Method Summary
 int compareTo(HLogKey o)
           
 boolean equals(Object obj)
           
 WALProtos.WALKey.Builder getBuilder(WALCellCodec.ByteStringCompressor compressor)
           
 UUID getClusterId()
          Get the id of the original cluster
 byte[] getEncodedRegionName()
           
 long getLogSeqNum()
           
 NavigableMap<byte[],Integer> getScopes()
           
 TableName getTablename()
           
 long getWriteTime()
           
 int hashCode()
           
 void readFields(DataInput in)
           
 void readFieldsFromPb(WALProtos.WALKey walKey, WALCellCodec.ByteStringUncompressor uncompressor)
           
 void setClusterId(UUID clusterId)
          Set the cluster id of this key.
 void setCompressionContext(org.apache.hadoop.hbase.regionserver.wal.CompressionContext compressionContext)
           
 void setScopes(NavigableMap<byte[],Integer> scopes)
           
 String toString()
           
 Map<String,Object> toStringMap()
          Produces a string map for this key.
 void write(DataOutput out)
          Deprecated. 
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG
Constructor Detail

HLogKey

public HLogKey()

HLogKey

public HLogKey(byte[] encodedRegionName,
               TableName tablename,
               long logSeqNum,
               long now,
               UUID clusterId)
Create the log key for writing to somewhere. We maintain the tablename mainly for debugging purposes. A regionName is always a sub-table object.

Parameters:
encodedRegionName - Encoded name of the region as returned by HRegionInfo#getEncodedNameAsBytes().
tablename - - name of table
logSeqNum - - log sequence number
now - Time at which this edit was written.
clusterId - of the cluster (used in Replication)

HLogKey

public HLogKey(WALProtos.WALKey walKey)
        throws IOException
Create HLogKey wrapper around protobuf WAL key; takes care of compression.

Throws:
IOException - Never, as the compression is not enabled.
Method Detail

setCompressionContext

public void setCompressionContext(org.apache.hadoop.hbase.regionserver.wal.CompressionContext compressionContext)
Parameters:
compressionContext - Compression context to use

getEncodedRegionName

public byte[] getEncodedRegionName()
Returns:
encoded region name

getTablename

public TableName getTablename()
Returns:
table name

getLogSeqNum

public long getLogSeqNum()
Returns:
log sequence number

getWriteTime

public long getWriteTime()
Returns:
the write time

getClusterId

public UUID getClusterId()
Get the id of the original cluster

Returns:
Cluster id.

getScopes

public NavigableMap<byte[],Integer> getScopes()

setScopes

public void setScopes(NavigableMap<byte[],Integer> scopes)

setClusterId

public void setClusterId(UUID clusterId)
Set the cluster id of this key.

Parameters:
clusterId -

toString

public String toString()
Overrides:
toString in class Object

toStringMap

public Map<String,Object> toStringMap()
Produces a string map for this key. Useful for programmatic use and manipulation of the data stored in an HLogKey, for example, printing as JSON.

Returns:
a Map containing data from this key

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

compareTo

public int compareTo(HLogKey o)
Specified by:
compareTo in interface Comparable<HLogKey>

write

@Deprecated
public void write(DataOutput out)
           throws IOException
Deprecated. 

Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
IOException

readFields

public void readFields(DataInput in)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
IOException

getBuilder

public WALProtos.WALKey.Builder getBuilder(WALCellCodec.ByteStringCompressor compressor)
                                    throws IOException
Throws:
IOException

readFieldsFromPb

public void readFieldsFromPb(WALProtos.WALKey walKey,
                             WALCellCodec.ByteStringUncompressor uncompressor)
                      throws IOException
Throws:
IOException


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.