public class CompactionTxnHandler extends TxnHandler
TxnHandler.DatabaseProduct, TxnHandler.RetryExceptionCLEANING_RESPONSE, conf, dbProduct, deadlockCnt, INITIATED_RESPONSE, INITIATED_STATE, LOCK_ACQUIRED, LOCK_EXCLUSIVE, LOCK_SEMI_SHARED, LOCK_SHARED, LOCK_WAITING, MAJOR_TYPE, MINOR_TYPE, READY_FOR_CLEANING, TXN_ABORTED, TXN_OPEN, WORKING_RESPONSE, WORKING_STATE| Constructor and Description |
|---|
CompactionTxnHandler(HiveConf conf) |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanEmptyAbortedTxns()
Clean up aborted transactions from txns that have no components in txn_components.
|
static ValidTxnList |
createValidCompactTxnList(GetOpenTxnsInfoResponse txns)
Transform a
GetOpenTxnsInfoResponse to a
ValidTxnList. |
List<String> |
findColumnsWithStats(CompactionInfo ci)
Queries metastore DB directly to find columns in the table which have statistics information.
|
CompactionInfo |
findNextToCompact(String workerId)
This will grab the next compaction request off of
the queue, and assign it to the worker.
|
Set<CompactionInfo> |
findPotentialCompactions(int maxAborted)
This will look through the completed_txn_components table and look for partitions or tables
that may be ready for compaction.
|
List<CompactionInfo> |
findReadyToClean()
Find entries in the queue that are ready to
be cleaned.
|
void |
markCleaned(CompactionInfo info)
This will remove an entry from the queue after
it has been compacted.
|
void |
markCompacted(CompactionInfo info)
This will mark an entry in the queue as compacted
and put it in the ready to clean state.
|
void |
revokeFromLocalWorkers(String hostname)
This will take all entries assigned to workers
on a host return them to INITIATED state.
|
void |
revokeTimedoutWorkers(long timeout)
This call will return all compaction queue
entries assigned to a worker but over the timeout back to the initiated state.
|
void |
setRunAs(long cq_id,
String user)
Sets the user to run as.
|
abortTxn, addDynamicPartitions, checkLock, checkRetryable, closeDbConn, closeStmt, commitTxn, compact, createValidReadTxnList, determineDatabaseProduct, getDbConn, getDbTime, getIdentifierQuoteString, getOpenTxns, getOpenTxnsInfo, heartbeat, heartbeatTxnRange, lock, lockNoWait, openTxns, showCompact, showLocks, unlockpublic CompactionTxnHandler(HiveConf conf)
public Set<CompactionInfo> findPotentialCompactions(int maxAborted) throws MetaException
maxAborted - Maximum number of aborted queries to allow before marking this as a
potential compaction.MetaExceptionpublic void setRunAs(long cq_id,
String user)
throws MetaException
cq_id - id of this entry in the queueuser - user to run the jobs asMetaExceptionpublic CompactionInfo findNextToCompact(String workerId) throws MetaException
workerId - id of the worker calling this, will be recorded in the dbMetaExceptionpublic void markCompacted(CompactionInfo info) throws MetaException
info - info on the compaction entry to mark as compacted.MetaExceptionpublic List<CompactionInfo> findReadyToClean() throws MetaException
MetaExceptionpublic void markCleaned(CompactionInfo info) throws MetaException
info - info on the compaction entry to removeMetaExceptionpublic void cleanEmptyAbortedTxns()
throws MetaException
MetaExceptionpublic void revokeFromLocalWorkers(String hostname) throws MetaException
hostname - Name of this host. It is assumed this prefixes the thread's worker id,
so that like hostname% will match the worker id.MetaExceptionpublic void revokeTimedoutWorkers(long timeout)
throws MetaException
revokeFromLocalWorkers(String) should be called
first.timeout - number of milliseconds since start time that should elapse before a worker is
declared dead.MetaExceptionpublic List<String> findColumnsWithStats(CompactionInfo ci) throws MetaException
ci includes partition info then per partition stats info is examined, otherwise
table level stats are examined.MetaExceptionpublic static ValidTxnList createValidCompactTxnList(GetOpenTxnsInfoResponse txns)
GetOpenTxnsInfoResponse to a
ValidTxnList. This assumes that the caller intends to
compact the files, and thus treats only open transactions as invalid.txns - txn list from the metastoreCopyright © 2017 The Apache Software Foundation. All rights reserved.