public class TxUtils extends Object
Constructor and Description |
---|
TxUtils() |
Modifier and Type | Method and Description |
---|---|
static Transaction |
createDummyTransaction(TransactionVisibilityState txVisibilityState)
Creates a "dummy" transaction based on the given txVisibilityState's state.
|
static long |
getFirstShortInProgress(Map<Long,TransactionManager.InProgressTx> inProgress)
Returns the write pointer for the first "short" transaction that in the in-progress set, or
Transaction.NO_TX_IN_PROGRESS if none. |
static long |
getInactiveTxBound(long timeMills,
long txMaxLifetimeMillis)
Returns the greatest transaction that has passed the maximum duration a transaction can be used for data writes.
|
static long |
getMaxVisibleTimestamp(Transaction tx)
Returns the maximum timestamp to use for time-range operations, based on the given transaction.
|
static long |
getOldestVisibleTimestamp(Map<byte[],Long> ttlByFamily,
Transaction tx)
Returns the oldest visible timestamp for the given transaction, based on the TTLs configured for each column
family.
|
static long |
getOldestVisibleTimestamp(Map<byte[],Long> ttlByFamily,
Transaction tx,
boolean readNonTxnData)
Returns the oldest visible timestamp for the given transaction, based on the TTLs configured for each column
family.
|
static long |
getPruneUpperBound(Transaction tx)
Returns the maximum transaction that can be removed from the invalid list for the state represented by the given
transaction.
|
static long |
getTimestamp(long txId)
Returns the timestamp at which the given transaction id was generated.
|
static long |
getTimestampForTTL(long cellTs)
Returns the timestamp for calculating time to live for the given cell timestamp.
|
static boolean |
isPreExistingVersion(long version)
Returns true if version was written before table was converted into transactional table, false otherwise.
|
public static long getOldestVisibleTimestamp(Map<byte[],Long> ttlByFamily, Transaction tx)
0
.ttlByFamily
- A map of column family name to TTL value (in milliseconds)tx
- The current transactionpublic static long getOldestVisibleTimestamp(Map<byte[],Long> ttlByFamily, Transaction tx, boolean readNonTxnData)
0
.ttlByFamily
- A map of column family name to TTL value (in milliseconds)tx
- The current transactionreadNonTxnData
- indicates that the timestamp returned should allow reading non-transactional datapublic static long getMaxVisibleTimestamp(Transaction tx)
tx
- The current transactionpublic static Transaction createDummyTransaction(TransactionVisibilityState txVisibilityState)
Long.MAX_VALUE
to avoid mis-identifying any cells
as being written by this transaction (and therefore visible).public static long getFirstShortInProgress(Map<Long,TransactionManager.InProgressTx> inProgress)
Transaction.NO_TX_IN_PROGRESS
if none.public static long getTimestampForTTL(long cellTs)
public static boolean isPreExistingVersion(long version)
public static long getPruneUpperBound(Transaction tx)
public static long getInactiveTxBound(long timeMills, long txMaxLifetimeMillis)
timeMills
there can be no writes from transactions equal to or smaller
than the returned bound.timeMills
- time in milliseconds for which the inactive transaction bound needs to be determinedtxMaxLifetimeMillis
- maximum duration a transaction can be used for data writes, in millisecondspublic static long getTimestamp(long txId)
txId
- transaction idCopyright © 2017 The Apache Software Foundation. All rights reserved.