public class HBaseTransactionPruningPlugin extends Object implements TransactionPruningPlugin
TransactionPruningPlugin
for HBase.
This plugin determines the prune upper bound for transactional HBase tables that use
coprocessor TransactionProcessor
.
Modifier and Type | Field and Description |
---|---|
protected org.apache.hadoop.conf.Configuration |
conf |
protected org.apache.hadoop.hbase.client.HConnection |
connection |
protected DataJanitorState |
dataJanitorState |
protected org.apache.hadoop.hbase.client.HBaseAdmin |
hBaseAdmin |
static org.slf4j.Logger |
LOG |
Constructor and Description |
---|
HBaseTransactionPruningPlugin() |
Modifier and Type | Method and Description |
---|---|
protected void |
createPruneTable(org.apache.hadoop.hbase.TableName stateTable)
Create the prune state table given the
TableName if the table doesn't exist already. |
void |
destroy()
Called once during the shutdown of the Transaction Service.
|
long |
fetchPruneUpperBound(long time,
long inactiveTransactionBound)
Determines prune upper bound for the data store as mentioned above.
|
protected SortedSet<byte[]> |
getTransactionalRegions() |
void |
initialize(org.apache.hadoop.conf.Configuration conf)
Called once when the Transaction Service starts up.
|
protected boolean |
isTransactionalTable(org.apache.hadoop.hbase.HTableDescriptor tableDescriptor)
Returns whether the table is a transactional table.
|
void |
pruneComplete(long time,
long maxPrunedInvalid)
After invalid list has been pruned, this cleans up state information that is no longer required.
|
public static final org.slf4j.Logger LOG
protected org.apache.hadoop.conf.Configuration conf
protected org.apache.hadoop.hbase.client.HBaseAdmin hBaseAdmin
protected org.apache.hadoop.hbase.client.HConnection connection
protected DataJanitorState dataJanitorState
public void initialize(org.apache.hadoop.conf.Configuration conf) throws IOException
TransactionPruningPlugin
initialize
in interface TransactionPruningPlugin
conf
- configuration for the pluginIOException
public long fetchPruneUpperBound(long time, long inactiveTransactionBound) throws IOException
fetchPruneUpperBound
in interface TransactionPruningPlugin
time
- start time of this prune iteration in millisecondsinactiveTransactionBound
- the largest invalid transaction that can be possibly removed
from the invalid list for the given time. This is an upper bound determined
by the Transaction Service, based on its knowledge of in-progress and invalid
transactions that may still have active processes and therefore future writes.
The plugin will typically return a reduced upper bound based on the state of
the invalid transaction data clean up in the data store.IOException
public void pruneComplete(long time, long maxPrunedInvalid) throws IOException
pruneComplete
in interface TransactionPruningPlugin
time
- start time of this prune iteration in milliseconds (same value as passed to
TransactionPruningPlugin.fetchPruneUpperBound(long, long)
in the same run)maxPrunedInvalid
- the largest invalid transaction that was removed from the invalid listIOException
public void destroy()
TransactionPruningPlugin
destroy
in interface TransactionPruningPlugin
protected void createPruneTable(org.apache.hadoop.hbase.TableName stateTable) throws IOException
TableName
if the table doesn't exist already.stateTable
- prune state table nameIOException
protected boolean isTransactionalTable(org.apache.hadoop.hbase.HTableDescriptor tableDescriptor)
TransactionProcessor
attached to it. Should be overriden if the users
attach a different coprocessor.tableDescriptor
- HTableDescriptor
of the tableprotected SortedSet<byte[]> getTransactionalRegions() throws IOException
IOException
Copyright © 2017 The Apache Software Foundation. All rights reserved.