Class TransactionBufferDisable
- java.lang.Object
-
- org.apache.pulsar.broker.transaction.buffer.impl.TransactionBufferDisable
-
- All Implemented Interfaces:
TransactionBuffer
public class TransactionBufferDisable extends java.lang.Object implements TransactionBuffer
Transaction buffer disable.
-
-
Constructor Summary
Constructors Constructor Description TransactionBufferDisable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.lang.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.java.util.concurrent.CompletableFuture<org.apache.bookkeeper.mledger.Position>appendBufferToTxn(org.apache.pulsar.client.api.transaction.TxnID txnId, long sequenceId, io.netty.buffer.ByteBuf buffer)Append the buffer to the transaction buffer.java.util.concurrent.CompletableFuture<java.lang.Void>checkIfTBRecoverCompletely(boolean isTxn)Wait TransactionBuffer Recovers completely.java.util.concurrent.CompletableFuture<java.lang.Void>clearSnapshot()Clear up the snapshot of the TransactionBuffer.java.util.concurrent.CompletableFuture<java.lang.Void>closeAsync()Close the buffer asynchronously.java.util.concurrent.CompletableFuture<java.lang.Void>commitTxn(org.apache.pulsar.client.api.transaction.TxnID txnID, long lowWaterMark)Commit the transaction and seal the buffer for this transaction.org.apache.bookkeeper.mledger.impl.PositionImplgetMaxReadPosition()Get the can read max position.org.apache.pulsar.common.policies.data.TransactionBufferStatsgetStats()Get transaction stats in buffer.org.apache.pulsar.common.policies.data.TransactionInBufferStatsgetTransactionInBufferStats(org.apache.pulsar.client.api.transaction.TxnID txnID)Get transaction in buffer stats.java.util.concurrent.CompletableFuture<TransactionMeta>getTransactionMeta(org.apache.pulsar.client.api.transaction.TxnID txnID)Return the metadata of a transaction in the buffer.booleanisTxnAborted(org.apache.pulsar.client.api.transaction.TxnID txnID)Close the buffer asynchronously.java.util.concurrent.CompletableFuture<TransactionBufferReader>openTransactionBufferReader(org.apache.pulsar.client.api.transaction.TxnID txnID, long startSequenceId)Open aTransactionBufferReaderto read entries of a given transaction starting from the provided sequenceId.java.util.concurrent.CompletableFuture<java.lang.Void>purgeTxns(java.util.List<java.lang.Long> dataLedgers)Purge all the data of the transactions who are committed and stored in the provided data ledgers.voidsyncMaxReadPositionForNormalPublish(org.apache.bookkeeper.mledger.impl.PositionImpl position)Sync max read position for normal publish.
-
-
-
Method Detail
-
getTransactionMeta
public java.util.concurrent.CompletableFuture<TransactionMeta> getTransactionMeta(org.apache.pulsar.client.api.transaction.TxnID txnID)
Description copied from interface:TransactionBufferReturn the metadata of a transaction in the buffer.- Specified by:
getTransactionMetain interfaceTransactionBuffer- Parameters:
txnID- the transaction id- Returns:
- a future represents the result of the operation
-
appendBufferToTxn
public java.util.concurrent.CompletableFuture<org.apache.bookkeeper.mledger.Position> appendBufferToTxn(org.apache.pulsar.client.api.transaction.TxnID txnId, long sequenceId, io.netty.buffer.ByteBuf buffer)Description copied from interface:TransactionBufferAppend the buffer to the transaction buffer.The entry will be indexed by txnId and sequenceId.
- Specified by:
appendBufferToTxnin interfaceTransactionBuffer- Parameters:
txnId- the transaction idsequenceId- the sequence id of the entry in this transaction buffer.buffer- the entry buffer- Returns:
- a future represents the result of the operation.
-
openTransactionBufferReader
public java.util.concurrent.CompletableFuture<TransactionBufferReader> openTransactionBufferReader(org.apache.pulsar.client.api.transaction.TxnID txnID, long startSequenceId)
Description copied from interface:TransactionBufferOpen aTransactionBufferReaderto read entries of a given transaction starting from the provided sequenceId.- Specified by:
openTransactionBufferReaderin interfaceTransactionBuffer- Parameters:
txnID- transaction idstartSequenceId- the sequence id to start read- Returns:
- a future represents the result of open operation.
-
commitTxn
public java.util.concurrent.CompletableFuture<java.lang.Void> commitTxn(org.apache.pulsar.client.api.transaction.TxnID txnID, long lowWaterMark)Description copied from interface:TransactionBufferCommit the transaction and seal the buffer for this transaction.If a transaction is sealed, no more entries can be
TransactionBuffer.appendBufferToTxn(TxnID, long, ByteBuf).- Specified by:
commitTxnin interfaceTransactionBuffer- Parameters:
txnID- the transaction idlowWaterMark- the low water mark of this transaction- Returns:
- a future represents the result of commit operation.
-
abortTxn
public java.util.concurrent.CompletableFuture<java.lang.Void> abortTxn(org.apache.pulsar.client.api.transaction.TxnID txnID, long lowWaterMark)Description copied from interface:TransactionBufferAbort the transaction and all the entries of this transaction will be discarded.- Specified by:
abortTxnin interfaceTransactionBuffer- Parameters:
txnID- the transaction idlowWaterMark- the low water mark of this transaction- Returns:
- a future represents the result of abort operation.
-
purgeTxns
public java.util.concurrent.CompletableFuture<java.lang.Void> purgeTxns(java.util.List<java.lang.Long> dataLedgers)
Description copied from interface:TransactionBufferPurge all the data of the transactions who are committed and stored in the provided data ledgers.This 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.
- Specified by:
purgeTxnsin interfaceTransactionBuffer- Parameters:
dataLedgers- the list of data ledgers.- Returns:
- a future represents the result of purge operations.
-
clearSnapshot
public java.util.concurrent.CompletableFuture<java.lang.Void> clearSnapshot()
Description copied from interface:TransactionBufferClear up the snapshot of the TransactionBuffer.- Specified by:
clearSnapshotin interfaceTransactionBuffer- Returns:
- Clear up operation result.
-
closeAsync
public java.util.concurrent.CompletableFuture<java.lang.Void> closeAsync()
Description copied from interface:TransactionBufferClose the buffer asynchronously.- Specified by:
closeAsyncin interfaceTransactionBuffer- Returns:
-
isTxnAborted
public boolean isTxnAborted(org.apache.pulsar.client.api.transaction.TxnID txnID)
Description copied from interface:TransactionBufferClose the buffer asynchronously.- Specified by:
isTxnAbortedin interfaceTransactionBuffer- Parameters:
txnID-TxnIDtxnId.- Returns:
- the txnId is aborted.
-
syncMaxReadPositionForNormalPublish
public void syncMaxReadPositionForNormalPublish(org.apache.bookkeeper.mledger.impl.PositionImpl position)
Description copied from interface:TransactionBufferSync max read position for normal publish.- Specified by:
syncMaxReadPositionForNormalPublishin interfaceTransactionBuffer- Parameters:
position-PositionImplthe position to sync.
-
getMaxReadPosition
public org.apache.bookkeeper.mledger.impl.PositionImpl getMaxReadPosition()
Description copied from interface:TransactionBufferGet the can read max position.- Specified by:
getMaxReadPositionin interfaceTransactionBuffer- Returns:
- the stable position.
-
getTransactionInBufferStats
public org.apache.pulsar.common.policies.data.TransactionInBufferStats getTransactionInBufferStats(org.apache.pulsar.client.api.transaction.TxnID txnID)
Description copied from interface:TransactionBufferGet transaction in buffer stats.- Specified by:
getTransactionInBufferStatsin interfaceTransactionBuffer- Returns:
- the transaction in buffer stats.
-
getStats
public org.apache.pulsar.common.policies.data.TransactionBufferStats getStats()
Description copied from interface:TransactionBufferGet transaction stats in buffer.- Specified by:
getStatsin interfaceTransactionBuffer- Returns:
- the transaction stats in buffer.
-
checkIfTBRecoverCompletely
public java.util.concurrent.CompletableFuture<java.lang.Void> checkIfTBRecoverCompletely(boolean isTxn)
Description copied from interface:TransactionBufferWait TransactionBuffer Recovers completely. Take snapshot after TB Recovers completely.- Specified by:
checkIfTBRecoverCompletelyin interfaceTransactionBuffer- Returns:
- a future which has completely if isTxn = false. Or a future return by takeSnapshot.
-
-