public class TransactionManager
extends com.google.common.util.concurrent.AbstractService
| Modifier and Type | Class and Description |
|---|---|
static class |
TransactionManager.InProgressTx
Represents some of the info on in-progress tx
|
| Constructor and Description |
|---|
TransactionManager(org.apache.hadoop.conf.Configuration config) |
TransactionManager(org.apache.hadoop.conf.Configuration conf,
TransactionStateStorage persistor,
MetricsCollector txMetricsCollector) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort(Transaction tx) |
boolean |
canCommit(Transaction tx,
Collection<byte[]> changeIds) |
Transaction |
checkpoint(Transaction originalTx) |
boolean |
commit(Transaction tx) |
void |
doStart() |
void |
doStop() |
TransactionSnapshot |
getCurrentState() |
int |
getExcludedListSize() |
int |
getInvalidSize() |
TransactionSnapshot |
getSnapshot() |
static long |
getTxExpirationFromWritePointer(long writePointer,
long timeoutInSeconds) |
boolean |
invalidate(long tx) |
void |
logStatistics()
Called from the tx service every 10 seconds.
|
void |
recoverState() |
void |
resetState()
Resets the state of the transaction manager.
|
Transaction |
startLong()
Start a long transaction.
|
Transaction |
startShort()
Start a short transaction with the default timeout.
|
Transaction |
startShort(int timeoutInSeconds)
Start a short transaction with a given timeout.
|
boolean |
takeSnapshot(OutputStream out)
Take a snapshot of the transaction state and serialize it into the given output stream.
|
boolean |
truncateInvalidTx(Set<Long> invalidTxIds)
Removes the given transaction ids from the invalid list.
|
boolean |
truncateInvalidTxBefore(long time)
Removes all transaction ids started before the given time from invalid list.
|
static Map<Long,TransactionManager.InProgressTx> |
txnBackwardsCompatCheck(int defaultLongTimeout,
long longTimeoutTolerance,
Map<Long,TransactionManager.InProgressTx> inProgress)
Check if in-progress transactions need to be migrated to have expiration time and type, if so do the migration.
|
public TransactionManager(org.apache.hadoop.conf.Configuration config)
@Inject
public TransactionManager(org.apache.hadoop.conf.Configuration conf,
@Nonnull
TransactionStateStorage persistor,
MetricsCollector txMetricsCollector)
public void doStart()
doStart in class com.google.common.util.concurrent.AbstractServicepublic TransactionSnapshot getSnapshot() throws IOException
IOExceptionpublic boolean takeSnapshot(OutputStream out) throws IOException
IOExceptionpublic TransactionSnapshot getCurrentState()
public void recoverState()
public static Map<Long,TransactionManager.InProgressTx> txnBackwardsCompatCheck(int defaultLongTimeout, long longTimeoutTolerance, Map<Long,TransactionManager.InProgressTx> inProgress)
public void resetState()
public void doStop()
doStop in class com.google.common.util.concurrent.AbstractServicepublic Transaction startShort()
public Transaction startShort(int timeoutInSeconds)
timeoutInSeconds - the time out period in seconds.public static long getTxExpirationFromWritePointer(long writePointer,
long timeoutInSeconds)
public Transaction startLong()
public boolean canCommit(Transaction tx, Collection<byte[]> changeIds) throws TransactionNotInProgressException
public boolean commit(Transaction tx) throws TransactionNotInProgressException
public void abort(Transaction tx)
public boolean invalidate(long tx)
public boolean truncateInvalidTx(Set<Long> invalidTxIds)
invalidTxIds - transaction idspublic boolean truncateInvalidTxBefore(long time)
throws InvalidTruncateTimeException
time - time in millisecondsInvalidTruncateTimeException - if there are any in-progress transactions started before given timepublic Transaction checkpoint(Transaction originalTx) throws TransactionNotInProgressException
public int getExcludedListSize()
public int getInvalidSize()
public void logStatistics()
Copyright © 2016 The Apache Software Foundation. All rights reserved.