Class 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.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.
      java.util.concurrent.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.
      java.util.concurrent.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.
      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.
      void syncMaxReadPositionForNormalPublish​(org.apache.bookkeeper.mledger.impl.PositionImpl position)
      Sync max read position for normal publish.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TransactionBufferDisable

        public TransactionBufferDisable()
    • Method Detail

      • getTransactionMeta

        public java.util.concurrent.CompletableFuture<TransactionMeta> getTransactionMeta​(org.apache.pulsar.client.api.transaction.TxnID txnID)
        Description copied from interface: TransactionBuffer
        Return the metadata of a transaction in the buffer.
        Specified by:
        getTransactionMeta in interface TransactionBuffer
        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: TransactionBuffer
        Append the buffer to the transaction buffer.

        The entry will be indexed by txnId and sequenceId.

        Specified by:
        appendBufferToTxn in interface TransactionBuffer
        Parameters:
        txnId - the transaction id
        sequenceId - 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: TransactionBuffer
        Open a TransactionBufferReader to read entries of a given transaction starting from the provided sequenceId.
        Specified by:
        openTransactionBufferReader in interface TransactionBuffer
        Parameters:
        txnID - transaction id
        startSequenceId - 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: TransactionBuffer
        Commit 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:
        commitTxn in interface TransactionBuffer
        Parameters:
        txnID - the transaction id
        lowWaterMark - 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: TransactionBuffer
        Abort the transaction and all the entries of this transaction will be discarded.
        Specified by:
        abortTxn in interface TransactionBuffer
        Parameters:
        txnID - the transaction id
        lowWaterMark - 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: TransactionBuffer
        Purge 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:
        purgeTxns in interface TransactionBuffer
        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: TransactionBuffer
        Clear up the snapshot of the TransactionBuffer.
        Specified by:
        clearSnapshot in interface TransactionBuffer
        Returns:
        Clear up operation result.
      • closeAsync

        public java.util.concurrent.CompletableFuture<java.lang.Void> closeAsync()
        Description copied from interface: TransactionBuffer
        Close the buffer asynchronously.
        Specified by:
        closeAsync in interface TransactionBuffer
        Returns:
      • isTxnAborted

        public boolean isTxnAborted​(org.apache.pulsar.client.api.transaction.TxnID txnID)
        Description copied from interface: TransactionBuffer
        Close the buffer asynchronously.
        Specified by:
        isTxnAborted in interface TransactionBuffer
        Parameters:
        txnID - TxnID txnId.
        Returns:
        the txnId is aborted.
      • syncMaxReadPositionForNormalPublish

        public void syncMaxReadPositionForNormalPublish​(org.apache.bookkeeper.mledger.impl.PositionImpl position)
        Description copied from interface: TransactionBuffer
        Sync max read position for normal publish.
        Specified by:
        syncMaxReadPositionForNormalPublish in interface TransactionBuffer
        Parameters:
        position - PositionImpl the position to sync.
      • getMaxReadPosition

        public org.apache.bookkeeper.mledger.impl.PositionImpl getMaxReadPosition()
        Description copied from interface: TransactionBuffer
        Get the can read max position.
        Specified by:
        getMaxReadPosition in interface TransactionBuffer
        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: TransactionBuffer
        Get transaction in buffer stats.
        Specified by:
        getTransactionInBufferStats in interface TransactionBuffer
        Returns:
        the transaction in buffer stats.
      • getStats

        public org.apache.pulsar.common.policies.data.TransactionBufferStats getStats()
        Description copied from interface: TransactionBuffer
        Get transaction stats in buffer.
        Specified by:
        getStats in interface TransactionBuffer
        Returns:
        the transaction stats in buffer.
      • checkIfTBRecoverCompletely

        public java.util.concurrent.CompletableFuture<java.lang.Void> checkIfTBRecoverCompletely​(boolean isTxn)
        Description copied from interface: TransactionBuffer
        Wait TransactionBuffer Recovers completely. Take snapshot after TB Recovers completely.
        Specified by:
        checkIfTBRecoverCompletely in interface TransactionBuffer
        Returns:
        a future which has completely if isTxn = false. Or a future return by takeSnapshot.