@InterfaceAudience.Private
@InterfaceStability.Evolving
public interface TxnStore
extends org.apache.hadoop.conf.Configurable
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.
|
AllocateTableWriteIdsResponse |
allocateTableWriteIds(AllocateTableWriteIdsRequest rqst)
Allocate a write ID for the given table and associate it with 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 |
cleanTxnToWriteIdTable()
Clean up entries from TXN_TO_WRITE_ID table less than min_uncommited_txnid as found by
min(NEXT_TXN_ID.ntxn_next, min(MIN_HISTORY_LEVEL.mhl_min_open_txnid), min(Aborted TXNS.txn_id)).
|
long |
cleanupMaterializationRebuildLocks(org.apache.hadoop.hive.common.ValidTxnList validTxnList,
long timeout) |
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.
|
Materialization |
getMaterializationInvalidationInfo(CreationMetadata cm,
String validTxnList)
Get invalidation info for the materialization.
|
TxnStore.MutexAPI |
getMutexAPI() |
GetOpenTxnsResponse |
getOpenTxns()
Get list of valid transactions.
|
GetOpenTxnsInfoResponse |
getOpenTxnsInfo()
Get information about open transactions.
|
GetValidWriteIdsResponse |
getValidWriteIds(GetValidWriteIdsRequest rqst)
Gets the list of valid write ids for the given table wrt to current txn
|
void |
heartbeat(HeartbeatRequest ids)
Send a heartbeat for a lock or a transaction
|
boolean |
heartbeatLockMaterializationRebuild(String dbName,
String tableName,
long txnId) |
HeartbeatTxnRangeResponse |
heartbeatTxnRange(HeartbeatTxnRangeRequest rqst)
Heartbeat a group of transactions together
|
LockResponse |
lock(LockRequest rqst)
Obtain a lock.
|
LockResponse |
lockMaterializationRebuild(String dbName,
String tableName,
long txnId) |
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() |
void |
onRename(String oldCatName,
String oldDbName,
String oldTabName,
String oldPartName,
String newCatName,
String newDbName,
String newTabName,
String newPartName) |
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 |
replTableWriteIdState(ReplTblWriteIdStateRequest rqst)
Replicate Table Write Ids state to mark aborted write ids and writeid high water mark.
|
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 |
seedWriteIdOnAcidConversion(InitializeTableWriteIdsRequest rqst)
Called on conversion of existing table to full acid.
|
void |
setCompactionHighestWriteId(CompactionInfo ci,
long highestWriteId)
Record the highest write id that the
ci compaction job will pay attention to. |
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
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
void replTableWriteIdState(ReplTblWriteIdStateRequest rqst) throws MetaException
rqst
- info on table/partitions and writeid snapshot to replicate.MetaException
- in case of failureMaterialization getMaterializationInvalidationInfo(CreationMetadata cm, String validTxnList) throws MetaException
cm
- creation metadata for the materializationvalidTxnList
- valid transaction list for snapshot taken for current queryMetaException
LockResponse lockMaterializationRebuild(String dbName, String tableName, long txnId) throws MetaException
MetaException
boolean heartbeatLockMaterializationRebuild(String dbName, String tableName, long txnId) throws MetaException
MetaException
long cleanupMaterializationRebuildLocks(org.apache.hadoop.hive.common.ValidTxnList validTxnList, long timeout) throws MetaException
MetaException
GetValidWriteIdsResponse getValidWriteIds(GetValidWriteIdsRequest rqst) throws NoSuchTxnException, MetaException
rqst
- info on transaction and list of table names associated with given transactionNoSuchTxnException
MetaException
AllocateTableWriteIdsResponse allocateTableWriteIds(AllocateTableWriteIdsRequest rqst) throws NoSuchTxnException, TxnAbortedException, MetaException
rqst
- info on transaction and table to allocate write idNoSuchTxnException
TxnAbortedException
MetaException
void seedWriteIdOnAcidConversion(InitializeTableWriteIdsRequest rqst) throws MetaException
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 onRename(String oldCatName, String oldDbName, String oldTabName, String oldPartName, String newCatName, String newDbName, String newTabName, String newPartName) throws MetaException
MetaException
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 cleanTxnToWriteIdTable() throws MetaException
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 setCompactionHighestWriteId(CompactionInfo ci, long highestWriteId) 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 © 2022 The Apache Software Foundation. All rights reserved.