Class MLTransactionMetadataStore
java.lang.Object
org.apache.pulsar.transaction.coordinator.TransactionMetadataStoreState
org.apache.pulsar.transaction.coordinator.impl.MLTransactionMetadataStore
- All Implemented Interfaces:
TransactionMetadataStore
public class MLTransactionMetadataStore
extends TransactionMetadataStoreState
implements TransactionMetadataStore
The provider that offers managed ledger implementation of
TransactionMetadataStore.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.pulsar.transaction.coordinator.TransactionMetadataStoreState
TransactionMetadataStoreState.State -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMLTransactionMetadataStore(TransactionCoordinatorID tcID, MLTransactionLogImpl mlTransactionLog, TransactionTimeoutTracker timeoutTracker, MLTransactionSequenceIdGenerator sequenceIdGenerator, long maxActiveTransactionsPerCoordinator) -
Method Summary
Modifier and TypeMethodDescriptionaddAckedPartitionToTxn(org.apache.pulsar.client.api.transaction.TxnID txnID, List<TransactionSubscription> txnSubscriptions) 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.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.getTxnStatus(org.apache.pulsar.client.api.transaction.TxnID txnID) Query theTxnStatusof a given transaction txnid.init(TransactionRecoverTracker recoverTracker) CompletableFuture<org.apache.pulsar.client.api.transaction.TxnID>newTransaction(long timeOut, String owner) Create a new transaction in the transaction metadata store.static List<TransactionSubscription>subscriptionToTxnSubscription(List<Subscription> subscriptions) static List<Subscription>txnSubscriptionToSubscription(List<TransactionSubscription> tnxSubscriptions) updateTxnStatus(org.apache.pulsar.client.api.transaction.TxnID txnID, TxnStatus newStatus, TxnStatus expectedStatus, boolean isTimeout) Update the transaction from expectedStatus to newStatus.Methods inherited from class org.apache.pulsar.transaction.coordinator.TransactionMetadataStoreState
changeToCloseState, changeToClosingState, changeToInitializingState, changeToReadyState, checkIfReady, getState
-
Field Details
-
recoverTime
-
-
Constructor Details
-
MLTransactionMetadataStore
public MLTransactionMetadataStore(TransactionCoordinatorID tcID, MLTransactionLogImpl mlTransactionLog, TransactionTimeoutTracker timeoutTracker, MLTransactionSequenceIdGenerator sequenceIdGenerator, long maxActiveTransactionsPerCoordinator)
-
-
Method Details
-
init
-
getTxnStatus
public CompletableFuture<TxnStatus> getTxnStatus(org.apache.pulsar.client.api.transaction.TxnID txnID) Description copied from interface:TransactionMetadataStoreQuery theTxnStatusof a given transaction txnid.- Specified by:
getTxnStatusin interfaceTransactionMetadataStore- Parameters:
txnID- transaction id- Returns:
- a future represents the result of this operation.
it returns
TxnStatusof the given transaction.
-
getTxnMeta
Description copied from interface:TransactionMetadataStoreQuery theTxnMetaof a given transaction txnid.- Specified by:
getTxnMetain interfaceTransactionMetadataStore- Parameters:
txnID- transaction id- Returns:
- a future represents the result of this operation.
it returns
TxnMetaof the given transaction.
-
newTransaction
public CompletableFuture<org.apache.pulsar.client.api.transaction.TxnID> newTransaction(long timeOut, String owner) Description copied from interface:TransactionMetadataStoreCreate a new transaction in the transaction metadata store.- Specified by:
newTransactionin interfaceTransactionMetadataStore- Parameters:
timeOut- 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
public CompletableFuture<Void> addProducedPartitionToTxn(org.apache.pulsar.client.api.transaction.TxnID txnID, List<String> partitions) Description copied from interface:TransactionMetadataStoreAdd the produced partitions to transaction identified by txnid.- Specified by:
addProducedPartitionToTxnin interfaceTransactionMetadataStore- Parameters:
txnID- transaction idpartitions- the list of partitions that a transaction produces to- Returns:
- a future represents the result of this operation
-
addAckedPartitionToTxn
public CompletableFuture<Void> addAckedPartitionToTxn(org.apache.pulsar.client.api.transaction.TxnID txnID, List<TransactionSubscription> txnSubscriptions) Description copied from interface:TransactionMetadataStoreAdd the acked partitions to transaction identified by txnid.- Specified by:
addAckedPartitionToTxnin interfaceTransactionMetadataStore- Parameters:
txnID- transaction idtxnSubscriptions- the list of partitions that a transaction acknowledge to- Returns:
- a future represents the result of the operation
-
updateTxnStatus
public CompletableFuture<Void> updateTxnStatus(org.apache.pulsar.client.api.transaction.TxnID txnID, TxnStatus newStatus, TxnStatus expectedStatus, boolean isTimeout) Description copied from interface:TransactionMetadataStoreUpdate the transaction from expectedStatus to newStatus.If the current transaction status is not expectedStatus, the update will be failed.
- Specified by:
updateTxnStatusin interfaceTransactionMetadataStore- 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
public long getLowWaterMark()Description copied from interface:TransactionMetadataStoreGet the low water mark of this tc, in order to delete unless transaction in transaction buffer and pending ack.- Specified by:
getLowWaterMarkin interfaceTransactionMetadataStore- Returns:
- long
longthe lowWaterMark
-
getTransactionCoordinatorID
Description copied from interface:TransactionMetadataStoreGet the transaction coordinator id.- Specified by:
getTransactionCoordinatorIDin interfaceTransactionMetadataStore- Returns:
- transaction coordinator id
-
getCoordinatorStats
Description copied from interface:TransactionMetadataStoreGet the transaction metadata store stats.- Specified by:
getCoordinatorStatsin interfaceTransactionMetadataStore- Returns:
- TransactionCoordinatorStats
TransactionCoordinatorStats
-
closeAsync
Description copied from interface:TransactionMetadataStoreClose the transaction metadata store.- Specified by:
closeAsyncin interfaceTransactionMetadataStore- Returns:
- a future represents the result of this operation
-
getMetadataStoreStats
Description copied from interface:TransactionMetadataStoreGet the transaction metadata store stats.- Specified by:
getMetadataStoreStatsin interfaceTransactionMetadataStore- Returns:
- TransactionMetadataStoreStats
TransactionMetadataStoreStats
-
getSlowTransactions
Description copied from interface:TransactionMetadataStoreGet the transactions witch timeout is bigger than given timeout.- Specified by:
getSlowTransactionsin interfaceTransactionMetadataStore- Returns:
TxnMetathe txnMetas of slow transactions
-
txnSubscriptionToSubscription
public static List<Subscription> txnSubscriptionToSubscription(List<TransactionSubscription> tnxSubscriptions) -
subscriptionToTxnSubscription
public static List<TransactionSubscription> subscriptionToTxnSubscription(List<Subscription> subscriptions) -
getManagedLedger
-
getAttributes
Description copied from interface:TransactionMetadataStoreGet the transaction metadata store OpenTelemetry attributes.- Specified by:
getAttributesin interfaceTransactionMetadataStore- Returns:
- TransactionMetadataStoreAttributes
TransactionMetadataStoreAttributes
-