Class PendingAckHandleDisabled
- All Implemented Interfaces:
PendingAckHandle
PendingAckHandle.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabortTxn(org.apache.pulsar.client.api.transaction.TxnID txnId, Consumer consumer, long lowWaterMark) Abort a transaction.booleanCheck if the PendingAckStore is init.booleancheckIsCanDeleteConsumerPendingAck(org.apache.bookkeeper.mledger.impl.PositionImpl position) Judge the all ack set point have acked by normal ack and transaction pending ack.org.apache.pulsar.common.stats.PositionInPendingAckStatscheckPositionInPendingAckState(org.apache.bookkeeper.mledger.impl.PositionImpl position, Integer batchIndex) Get the stats of this message position is in pending ack.voidclearIndividualPosition(org.apache.bookkeeper.mledger.Position position) When the position is actually deleted, we can use this method to clear the cache for individual ack messages.Close the pending ack handle.commitTxn(org.apache.pulsar.client.api.transaction.TxnID txnID, Map<String, Long> properties, long lowWaterMark) Commit a transaction.cumulativeAcknowledgeMessage(org.apache.pulsar.client.api.transaction.TxnID txnID, List<org.apache.bookkeeper.mledger.impl.PositionImpl> positions) Acknowledge message(s) for an ongoing transaction.org.apache.bookkeeper.mledger.impl.PositionImplgetPositionInPendingAck(org.apache.bookkeeper.mledger.impl.PositionImpl position) If it returns null, it means this Position is not in pendingAck.org.apache.pulsar.common.policies.data.TransactionPendingAckStatsgetStats(boolean lowWaterMarks) Get pending ack handle stats.org.apache.pulsar.common.policies.data.TransactionInPendingAckStatsgetTransactionInPendingAckStats(org.apache.pulsar.client.api.transaction.TxnID txnID) Get transaction in pending ack stats.individualAcknowledgeMessage(org.apache.pulsar.client.api.transaction.TxnID txnID, List<org.apache.commons.lang3.tuple.MutablePair<org.apache.bookkeeper.mledger.impl.PositionImpl, Integer>> positions) Acknowledge message(s) for an ongoing transaction.Pending ack recover whether ready future.voidsyncBatchPositionAckSetForTransaction(org.apache.bookkeeper.mledger.impl.PositionImpl position) Sync the position ack set, in order to clean up the cache of this position for pending ack handle.
-
Constructor Details
-
PendingAckHandleDisabled
public PendingAckHandleDisabled()
-
-
Method Details
-
individualAcknowledgeMessage
public CompletableFuture<Void> individualAcknowledgeMessage(org.apache.pulsar.client.api.transaction.TxnID txnID, List<org.apache.commons.lang3.tuple.MutablePair<org.apache.bookkeeper.mledger.impl.PositionImpl, Integer>> positions) Description copied from interface:PendingAckHandleAcknowledge message(s) for an ongoing transaction.It can be of
CommandAck.AckType.Individual. Single messages acked by ongoing transaction will be put in pending_ack state and only marked as deleted after transaction is committed.If transaction is aborted all messages acked by it will be put back to pending state.
Client will not send batch size to server, we get the batch size from consumer pending ack. When we get the Batch size, we can accurate batch ack of this position.
- Specified by:
individualAcknowledgeMessagein interfacePendingAckHandle- Parameters:
txnID-TxnIDTransactionID of an ongoing transaction trying to sck message.positions-MutablePairthe pair of positions and these batch size.- Returns:
- the future of this operation.
-
cumulativeAcknowledgeMessage
public CompletableFuture<Void> cumulativeAcknowledgeMessage(org.apache.pulsar.client.api.transaction.TxnID txnID, List<org.apache.bookkeeper.mledger.impl.PositionImpl> positions) Description copied from interface:PendingAckHandleAcknowledge message(s) for an ongoing transaction.It can be of
CommandAck.AckType.Cumulative. Single messages acked by ongoing transaction will be put in pending_ack state and only marked as deleted after transaction is committed.For a moment, we only allow one transaction cumulative ack multiple times when the position is greater than the old one.
We have a transaction with cumulative ack, if other transaction want to cumulative ack, we will return
TransactionConflictException.If an ongoing transaction cumulative acked a message and then try to ack single message which is greater than that one it cumulative acked, it'll succeed.
- Specified by:
cumulativeAcknowledgeMessagein interfacePendingAckHandle- Parameters:
txnID-TxnIDTransactionID of an ongoing transaction trying to sck message.positions-MutablePairthe pair of positions and these batch size.- Returns:
- the future of this operation.
-
commitTxn
public CompletableFuture<Void> commitTxn(org.apache.pulsar.client.api.transaction.TxnID txnID, Map<String, Long> properties, long lowWaterMark) Description copied from interface:PendingAckHandleCommit a transaction.- Specified by:
commitTxnin interfacePendingAckHandle- Parameters:
txnID-TxnIDto identify the transaction.properties- Additional user-defined properties that can be associated with a particular cursor position.lowWaterMark- the low water mark of this transaction- Returns:
- the future of this operation.
-
abortTxn
public CompletableFuture<Void> abortTxn(org.apache.pulsar.client.api.transaction.TxnID txnId, Consumer consumer, long lowWaterMark) Description copied from interface:PendingAckHandleAbort a transaction.- Specified by:
abortTxnin interfacePendingAckHandle- Parameters:
txnId-TxnIDto identify the transaction.consumer-Consumerwhich aborting transaction.lowWaterMark- the low water mark of this transaction- Returns:
- the future of this operation.
-
syncBatchPositionAckSetForTransaction
public void syncBatchPositionAckSetForTransaction(org.apache.bookkeeper.mledger.impl.PositionImpl position) Description copied from interface:PendingAckHandleSync the position ack set, in order to clean up the cache of this position for pending ack handle.- Specified by:
syncBatchPositionAckSetForTransactionin interfacePendingAckHandle- Parameters:
position-Positionwhich position need to sync and carry it batch size
-
checkIsCanDeleteConsumerPendingAck
public boolean checkIsCanDeleteConsumerPendingAck(org.apache.bookkeeper.mledger.impl.PositionImpl position) Description copied from interface:PendingAckHandleJudge the all ack set point have acked by normal ack and transaction pending ack.- Specified by:
checkIsCanDeleteConsumerPendingAckin interfacePendingAckHandle- Parameters:
position-Positionwhich position need to check
-
clearIndividualPosition
public void clearIndividualPosition(org.apache.bookkeeper.mledger.Position position) Description copied from interface:PendingAckHandleWhen the position is actually deleted, we can use this method to clear the cache for individual ack messages.- Specified by:
clearIndividualPositionin interfacePendingAckHandle- Parameters:
position-Positionwhich position need to clear
-
pendingAckHandleFuture
Description copied from interface:PendingAckHandlePending ack recover whether ready future.- Specified by:
pendingAckHandleFuturein interfacePendingAckHandle- Returns:
- the future of result.
-
getTransactionInPendingAckStats
public org.apache.pulsar.common.policies.data.TransactionInPendingAckStats getTransactionInPendingAckStats(org.apache.pulsar.client.api.transaction.TxnID txnID) Description copied from interface:PendingAckHandleGet transaction in pending ack stats.- Specified by:
getTransactionInPendingAckStatsin interfacePendingAckHandle- Parameters:
txnID- the txnID- Returns:
- the stats of this transaction in pending ack.
-
getStats
public org.apache.pulsar.common.policies.data.TransactionPendingAckStats getStats(boolean lowWaterMarks) Description copied from interface:PendingAckHandleGet pending ack handle stats.- Specified by:
getStatsin interfacePendingAckHandle- Returns:
- the stats of this pending ack handle.
-
closeAsync
Description copied from interface:PendingAckHandleClose the pending ack handle.- Specified by:
closeAsyncin interfacePendingAckHandle- Returns:
- the future of this operation.
-
checkIfPendingAckStoreInit
public boolean checkIfPendingAckStoreInit()Description copied from interface:PendingAckHandleCheck if the PendingAckStore is init.- Specified by:
checkIfPendingAckStoreInitin interfacePendingAckHandle- Returns:
- if the PendingAckStore is init.
-
getPositionInPendingAck
public org.apache.bookkeeper.mledger.impl.PositionImpl getPositionInPendingAck(org.apache.bookkeeper.mledger.impl.PositionImpl position) Description copied from interface:PendingAckHandleIf it returns null, it means this Position is not in pendingAck.If it does not return null, it means this Position is in pendingAck and if it is batch Position, it will return the corresponding ackSet in pendingAck
- Specified by:
getPositionInPendingAckin interfacePendingAckHandle- Parameters:
position-Positionwitch need to get in pendingAck- Returns:
Positionreturn the position in pendingAck
-
checkPositionInPendingAckState
public org.apache.pulsar.common.stats.PositionInPendingAckStats checkPositionInPendingAckState(org.apache.bookkeeper.mledger.impl.PositionImpl position, Integer batchIndex) Description copied from interface:PendingAckHandleGet the stats of this message position is in pending ack.- Specified by:
checkPositionInPendingAckStatein interfacePendingAckHandle- Parameters:
position- message position.batchIndex- the batch index of ths position.- Returns:
- the stats of the message position.
-