Interface TransactionMetadataStore
- All Known Implementing Classes:
MLTransactionMetadataStore
@Beta
public interface TransactionMetadataStore
A store for storing all the transaction metadata.
-
Method Summary
Modifier and TypeMethodDescriptionaddAckedPartitionToTxn(org.apache.pulsar.client.api.transaction.TxnID txnid, List<TransactionSubscription> partitions) Add the acked partitions to transaction identified by txnid.addProducedPartitionToTxn(org.apache.pulsar.client.api.transaction.TxnID txnid, List<String> partitions) Add the produced partitions to transaction identified by txnid.Close the transaction metadata store.Get the transaction metadata store OpenTelemetry attributes.Get the transaction metadata store stats.default longGet the low water mark of this tc, in order to delete unless transaction in transaction buffer and pending ack.Get the transaction metadata store stats.getSlowTransactions(long timeout) Get the transactions witch timeout is bigger than given timeout.Get the transaction coordinator id.getTxnMeta(org.apache.pulsar.client.api.transaction.TxnID txnid) Query theTxnMetaof a given transaction txnid.default CompletableFuture<TxnStatus>getTxnStatus(org.apache.pulsar.client.api.transaction.TxnID txnid) Query theTxnStatusof a given transaction txnid.CompletableFuture<org.apache.pulsar.client.api.transaction.TxnID>newTransaction(long timeoutInMills, String owner) Create a new transaction in the transaction metadata store.updateTxnStatus(org.apache.pulsar.client.api.transaction.TxnID txnid, TxnStatus newStatus, TxnStatus expectedStatus, boolean isTimeout) Update the transaction from expectedStatus to newStatus.
-
Method Details
-
getTxnStatus
default CompletableFuture<TxnStatus> getTxnStatus(org.apache.pulsar.client.api.transaction.TxnID txnid) Query theTxnStatusof a given transaction txnid.- Parameters:
txnid- transaction id- Returns:
- a future represents the result of this operation.
it returns
TxnStatusof the given transaction.
-
getTxnMeta
Query theTxnMetaof a given transaction txnid.- Parameters:
txnid- transaction id- Returns:
- a future represents the result of this operation.
it returns
TxnMetaof the given transaction.
-
newTransaction
CompletableFuture<org.apache.pulsar.client.api.transaction.TxnID> newTransaction(long timeoutInMills, String owner) Create a new transaction in the transaction metadata store.- Parameters:
timeoutInMills- the timeout duration of the transaction in millsowner- the role which is the owner of the transaction- Returns:
- a future represents the result of creating a new transaction.
it returns
TxnIDas the identifier for identifying the transaction.
-
addProducedPartitionToTxn
CompletableFuture<Void> addProducedPartitionToTxn(org.apache.pulsar.client.api.transaction.TxnID txnid, List<String> partitions) Add the produced partitions to transaction identified by txnid.- Parameters:
txnid- transaction idpartitions- the list of partitions that a transaction produces to- Returns:
- a future represents the result of this operation
-
addAckedPartitionToTxn
CompletableFuture<Void> addAckedPartitionToTxn(org.apache.pulsar.client.api.transaction.TxnID txnid, List<TransactionSubscription> partitions) Add the acked partitions to transaction identified by txnid.- Parameters:
txnid- transaction idpartitions- the list of partitions that a transaction acknowledge to- Returns:
- a future represents the result of the operation
-
updateTxnStatus
CompletableFuture<Void> updateTxnStatus(org.apache.pulsar.client.api.transaction.TxnID txnid, TxnStatus newStatus, TxnStatus expectedStatus, boolean isTimeout) Update the transaction from expectedStatus to newStatus.If the current transaction status is not expectedStatus, the update will be failed.
- Parameters:
txnid-TxnIDfor update txn statusnewStatus- the new txn status that the transaction should be updated toexpectedStatus- the expected status that the transaction should beisTimeout- the update txn status operation is it timeout- Returns:
- a future represents the result of the operation
-
getLowWaterMark
default long getLowWaterMark()Get the low water mark of this tc, in order to delete unless transaction in transaction buffer and pending ack.- Returns:
- long
longthe lowWaterMark
-
getTransactionCoordinatorID
TransactionCoordinatorID getTransactionCoordinatorID()Get the transaction coordinator id.- Returns:
- transaction coordinator id
-
getCoordinatorStats
TransactionCoordinatorStats getCoordinatorStats()Get the transaction metadata store stats.- Returns:
- TransactionCoordinatorStats
TransactionCoordinatorStats
-
closeAsync
CompletableFuture<Void> closeAsync()Close the transaction metadata store.- Returns:
- a future represents the result of this operation
-
getMetadataStoreStats
TransactionMetadataStoreStats getMetadataStoreStats()Get the transaction metadata store stats.- Returns:
- TransactionMetadataStoreStats
TransactionMetadataStoreStats
-
getAttributes
Get the transaction metadata store OpenTelemetry attributes.- Returns:
- TransactionMetadataStoreAttributes
TransactionMetadataStoreAttributes
-
getSlowTransactions
Get the transactions witch timeout is bigger than given timeout.- Returns:
TxnMetathe txnMetas of slow transactions
-