@InterfaceAudience.Private @InterfaceStability.Evolving public interface TxnStore
JavaUtils.txnIdToString(long)
and JavaUtils.lockIdToString(long)
in all messages.
The txnid:X and lockid:Y matches how Thrift object toString() methods are generated,
so keeping the format consistent makes grep'ing the logs much easier.
Note on HIVE_LOCKS.hl_last_heartbeat.
For locks that are part of transaction, we set this 0 (would rather set it to NULL but
Currently the DB schema has this NOT NULL) and only update/read heartbeat from corresponding
transaction in TXNS.Modifier and Type | Interface and Description |
---|---|
static class |
TxnStore.MUTEX_KEY |
static interface |
TxnStore.MutexAPI
This is primarily designed to provide coarse grained mutex support to operations running
inside the Metastore (of which there could be several instances).
|
Modifier and Type | Field and Description |
---|---|
static String |
ATTEMPTED_RESPONSE |
static String |
CLEANING_RESPONSE |
static String |
FAILED_RESPONSE |
static String |
INITIATED_RESPONSE |
static String |
SUCCEEDED_RESPONSE |
static int |
TIMED_OUT_TXN_ABORT_BATCH_SIZE |
static String |
WORKING_RESPONSE |
Modifier and Type | Method and Description |
---|---|
void |
abortTxn(AbortTxnRequest rqst)
Abort (rollback) a transaction.
|
void |
abortTxns(AbortTxnsRequest rqst)
Abort (rollback) a list of transactions in one request.
|
void |
addDynamicPartitions(AddDynamicPartitions rqst)
Add information on a set of dynamic partitions that participated in a transaction.
|
boolean |
checkFailedCompactions(CompactionInfo ci)
Determine if there are enough consecutive failures compacting a table or partition that no
new automatic compactions should be scheduled.
|
LockResponse |
checkLock(CheckLockRequest rqst)
Check whether a lock has been obtained.
|
void |
cleanEmptyAbortedTxns()
Clean up aborted transactions from txns that have no components in txn_components.
|
void |
cleanupRecords(HiveObjectType type,
Database db,
Table table,
Iterator<Partition> partitionIterator)
Clean up corresponding records in metastore tables
|
void |
commitTxn(CommitTxnRequest rqst)
Commit a transaction
|
CompactionResponse |
compact(CompactionRequest rqst)
Submit a compaction request into the queue.
|
void |
countOpenTxns()
Get the count for open transactions.
|
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.
|
TxnStore.MutexAPI |
getMutexAPI() |
GetOpenTxnsResponse |
getOpenTxns()
Get list of valid transactions.
|
GetOpenTxnsInfoResponse |
getOpenTxnsInfo()
Get information about open transactions.
|
void |
heartbeat(HeartbeatRequest ids)
Send a heartbeat for a lock or a transaction
|
HeartbeatTxnRangeResponse |
heartbeatTxnRange(HeartbeatTxnRangeRequest rqst)
Heartbeat a group of transactions together
|
LockResponse |
lock(LockRequest rqst)
Obtain a lock.
|
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 |
markFailed(CompactionInfo info)
Mark a compaction entry as failed.
|
int |
numLocksInLockTable() |
OpenTxnsResponse |
openTxns(OpenTxnRequest rqst)
Open a set of transactions
|
void |
performTimeOuts()
Timeout transactions and/or locks.
|
void |
performWriteSetGC()
WriteSet tracking is used to ensure proper transaction isolation.
|
void |
purgeCompactionHistory()
For any given compactable entity (partition, table if not partitioned) the history of compactions
may look like "sssfffaaasffss", for example.
|
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 |
setCompactionHighestTxnId(CompactionInfo ci,
long highestTxnId)
Record the highest txn id that the
ci compaction job will pay attention to. |
void |
setConf(HiveConf conf) |
void |
setHadoopJobId(String hadoopJobId,
long id)
Once a
ThreadPoolExecutor.Worker submits a job to the cluster,
it calls this to update the metadata. |
void |
setRunAs(long cq_id,
String user)
Sets the user to run as.
|
long |
setTimeout(long milliseconds) |
ShowCompactResponse |
showCompact(ShowCompactRequest rqst)
Show list of current compactions
|
ShowLocksResponse |
showLocks(ShowLocksRequest rqst)
Get information on current locks.
|
void |
unlock(UnlockRequest rqst)
Unlock a lock.
|
static final String INITIATED_RESPONSE
static final String WORKING_RESPONSE
static final String CLEANING_RESPONSE
static final String FAILED_RESPONSE
static final String SUCCEEDED_RESPONSE
static final String ATTEMPTED_RESPONSE
static final int TIMED_OUT_TXN_ABORT_BATCH_SIZE
void setConf(HiveConf conf)
GetOpenTxnsInfoResponse getOpenTxnsInfo() throws MetaException
MetaException
GetOpenTxnsResponse getOpenTxns() throws MetaException
MetaException
void countOpenTxns() throws MetaException
MetaException
OpenTxnsResponse openTxns(OpenTxnRequest rqst) throws MetaException
rqst
- request to open transactionsMetaException
void abortTxn(AbortTxnRequest rqst) throws NoSuchTxnException, MetaException, TxnAbortedException
rqst
- info on transaction to abortNoSuchTxnException
MetaException
TxnAbortedException
void abortTxns(AbortTxnsRequest rqst) throws NoSuchTxnException, MetaException
rqst
- info on transactions to abortNoSuchTxnException
MetaException
void commitTxn(CommitTxnRequest rqst) throws NoSuchTxnException, TxnAbortedException, MetaException
rqst
- info on transaction to commitNoSuchTxnException
TxnAbortedException
MetaException
LockResponse lock(LockRequest rqst) throws NoSuchTxnException, TxnAbortedException, MetaException
rqst
- information on the lock to obtain. If the requester is part of a transaction
the txn information must be included in the lock request.NoSuchTxnException
TxnAbortedException
MetaException
LockResponse checkLock(CheckLockRequest rqst) throws NoSuchTxnException, NoSuchLockException, TxnAbortedException, MetaException
lock(org.apache.hadoop.hive.metastore.api.LockRequest)
returned a wait
state.rqst
- info on the lock to checkNoSuchTxnException
NoSuchLockException
TxnAbortedException
MetaException
void unlock(UnlockRequest rqst) throws NoSuchLockException, TxnOpenException, MetaException
rqst
- lock to unlockNoSuchLockException
TxnOpenException
MetaException
ShowLocksResponse showLocks(ShowLocksRequest rqst) throws MetaException
rqst
- lock information to retrieveMetaException
void heartbeat(HeartbeatRequest ids) throws NoSuchTxnException, NoSuchLockException, TxnAbortedException, MetaException
ids
- lock and/or txn id to heartbeatNoSuchTxnException
NoSuchLockException
TxnAbortedException
MetaException
HeartbeatTxnRangeResponse heartbeatTxnRange(HeartbeatTxnRangeRequest rqst) throws MetaException
rqst
- set of transactions to heartbatMetaException
CompactionResponse compact(CompactionRequest rqst) throws MetaException
rqst
- information on what to compactMetaException
ShowCompactResponse showCompact(ShowCompactRequest rqst) throws MetaException
rqst
- info on which compactions to showMetaException
void addDynamicPartitions(AddDynamicPartitions rqst) throws NoSuchTxnException, TxnAbortedException, MetaException
rqst
- dynamic partition info.NoSuchTxnException
TxnAbortedException
MetaException
void cleanupRecords(HiveObjectType type, Database db, Table table, Iterator<Partition> partitionIterator) throws MetaException
type
- Hive object typedb
- database objecttable
- table objectpartitionIterator
- partition iteratorMetaException
void performTimeOuts()
Set<CompactionInfo> findPotentialCompactions(int maxAborted) throws MetaException
maxAborted
- Maximum number of aborted queries to allow before marking this as a
potential compaction.MetaException
void setRunAs(long cq_id, String user) throws MetaException
cq_id
- id of this entry in the queueuser
- user to run the jobs asMetaException
CompactionInfo findNextToCompact(String workerId) throws MetaException
workerId
- id of the worker calling this, will be recorded in the dbMetaException
void markCompacted(CompactionInfo info) throws MetaException
info
- info on the compaction entry to mark as compacted.MetaException
List<CompactionInfo> findReadyToClean() throws MetaException
MetaException
void markCleaned(CompactionInfo info) throws MetaException
info
- info on the compaction entry to removeMetaException
void markFailed(CompactionInfo info) throws MetaException
info
- information on the compaction that failed.MetaException
void cleanEmptyAbortedTxns() throws MetaException
markCleaned(CompactionInfo)
being called.MetaException
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.MetaException
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.MetaException
List<String> findColumnsWithStats(CompactionInfo ci) throws MetaException
ci
includes partition info then per partition stats info is examined, otherwise
table level stats are examined.MetaException
void setCompactionHighestTxnId(CompactionInfo ci, long highestTxnId) throws MetaException
ci
compaction job will pay attention to.MetaException
void purgeCompactionHistory() throws MetaException
MetaException
void performWriteSetGC()
boolean checkFailedCompactions(CompactionInfo ci) throws MetaException
ci
- Table or partition to check.MetaException
int numLocksInLockTable() throws SQLException, MetaException
SQLException
MetaException
long setTimeout(long milliseconds)
TxnStore.MutexAPI getMutexAPI()
void setHadoopJobId(String hadoopJobId, long id)
ThreadPoolExecutor.Worker
submits a job to the cluster,
it calls this to update the metadata.id
- CompactionInfo.id
Copyright © 2021 The Apache Software Foundation. All rights reserved.