public class TopicTransactionBuffer extends TopicTransactionBufferState implements TransactionBuffer, io.netty.util.TimerTask
| Modifier and Type | Class and Description |
|---|---|
static class |
TopicTransactionBuffer.TopicTransactionBufferRecover |
TopicTransactionBufferState.State| Constructor and Description |
|---|
TopicTransactionBuffer(PersistentTopic topic) |
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<Void> |
abortTxn(org.apache.pulsar.client.api.transaction.TxnID txnID,
long lowWaterMark)
Abort the transaction and all the entries of this transaction will
be discarded.
|
CompletableFuture<Position> |
appendBufferToTxn(org.apache.pulsar.client.api.transaction.TxnID txnId,
long sequenceId,
io.netty.buffer.ByteBuf buffer)
Append the buffer to the transaction buffer.
|
CompletableFuture<Void> |
checkIfTBRecoverCompletely(boolean isTxnEnabled)
Wait TransactionBuffer Recovers completely.
|
CompletableFuture<Void> |
clearSnapshot()
Clear up the snapshot of the TransactionBuffer.
|
CompletableFuture<Void> |
closeAsync()
Close the buffer asynchronously.
|
CompletableFuture<Void> |
commitTxn(org.apache.pulsar.client.api.transaction.TxnID txnID,
long lowWaterMark)
Commit the transaction and seal the buffer for this transaction.
|
PositionImpl |
getMaxReadPosition()
Get the can read max position.
|
org.apache.pulsar.common.policies.data.TransactionBufferStats |
getStats()
Get transaction stats in buffer.
|
org.apache.pulsar.common.policies.data.TransactionInBufferStats |
getTransactionInBufferStats(org.apache.pulsar.client.api.transaction.TxnID txnID)
Get transaction in buffer stats.
|
CompletableFuture<TransactionMeta> |
getTransactionMeta(org.apache.pulsar.client.api.transaction.TxnID txnID)
Return the metadata of a transaction in the buffer.
|
boolean |
isTxnAborted(org.apache.pulsar.client.api.transaction.TxnID txnID)
Close the buffer asynchronously.
|
CompletableFuture<TransactionBufferReader> |
openTransactionBufferReader(org.apache.pulsar.client.api.transaction.TxnID txnID,
long startSequenceId)
Open a
TransactionBufferReader to read entries of a given transaction
starting from the provided sequenceId. |
CompletableFuture<Void> |
purgeTxns(List<Long> dataLedgers)
Purge all the data of the transactions who are committed and stored
in the provided data ledgers.
|
void |
run(io.netty.util.Timeout timeout) |
void |
syncMaxReadPositionForNormalPublish(PositionImpl position)
Sync max read position for normal publish.
|
changeToCloseState, changeToInitializingState, changeToNoSnapshotState, changeToReadyState, changeToReadyStateFromNoSnapshot, checkIfNoSnapshot, checkIfReady, getStatepublic TopicTransactionBuffer(PersistentTopic topic)
public CompletableFuture<TransactionMeta> getTransactionMeta(org.apache.pulsar.client.api.transaction.TxnID txnID)
TransactionBuffergetTransactionMeta in interface TransactionBuffertxnID - the transaction idpublic CompletableFuture<Void> checkIfTBRecoverCompletely(boolean isTxnEnabled)
TransactionBuffercheckIfTBRecoverCompletely in interface TransactionBufferpublic CompletableFuture<Position> appendBufferToTxn(org.apache.pulsar.client.api.transaction.TxnID txnId, long sequenceId, io.netty.buffer.ByteBuf buffer)
TransactionBufferThe entry will be indexed by txnId and sequenceId.
appendBufferToTxn in interface TransactionBuffertxnId - the transaction idsequenceId - the sequence id of the entry in this transaction buffer.buffer - the entry bufferpublic CompletableFuture<TransactionBufferReader> openTransactionBufferReader(org.apache.pulsar.client.api.transaction.TxnID txnID, long startSequenceId)
TransactionBufferTransactionBufferReader to read entries of a given transaction
starting from the provided sequenceId.openTransactionBufferReader in interface TransactionBuffertxnID - transaction idstartSequenceId - the sequence id to start readpublic CompletableFuture<Void> commitTxn(org.apache.pulsar.client.api.transaction.TxnID txnID, long lowWaterMark)
TransactionBufferIf a transaction is sealed, no more entries can be TransactionBuffer.appendBufferToTxn(TxnID, long, ByteBuf).
commitTxn in interface TransactionBuffertxnID - the transaction idlowWaterMark - the low water mark of this transactionpublic CompletableFuture<Void> abortTxn(org.apache.pulsar.client.api.transaction.TxnID txnID, long lowWaterMark)
TransactionBufferabortTxn in interface TransactionBuffertxnID - the transaction idlowWaterMark - the low water mark of this transactionpublic CompletableFuture<Void> purgeTxns(List<Long> dataLedgers)
TransactionBufferThis method will be called by the broker before they delete the ledgers. It ensures that all the transactions committed in those ledgers can be purged.
purgeTxns in interface TransactionBufferdataLedgers - the list of data ledgers.public CompletableFuture<Void> clearSnapshot()
TransactionBufferclearSnapshot in interface TransactionBufferpublic CompletableFuture<Void> closeAsync()
TransactionBuffercloseAsync in interface TransactionBufferpublic boolean isTxnAborted(org.apache.pulsar.client.api.transaction.TxnID txnID)
TransactionBufferisTxnAborted in interface TransactionBuffertxnID - TxnID txnId.public void syncMaxReadPositionForNormalPublish(PositionImpl position)
TransactionBuffersyncMaxReadPositionForNormalPublish in interface TransactionBufferposition - PositionImpl the position to sync.public PositionImpl getMaxReadPosition()
TransactionBuffergetMaxReadPosition in interface TransactionBufferpublic org.apache.pulsar.common.policies.data.TransactionInBufferStats getTransactionInBufferStats(org.apache.pulsar.client.api.transaction.TxnID txnID)
TransactionBuffergetTransactionInBufferStats in interface TransactionBufferpublic org.apache.pulsar.common.policies.data.TransactionBufferStats getStats()
TransactionBuffergetStats in interface TransactionBufferpublic void run(io.netty.util.Timeout timeout)
run in interface io.netty.util.TimerTaskCopyright © 2017–2022 Apache Software Foundation. All rights reserved.