Class SnapshotSegmentAbortedTxnProcessorImpl

java.lang.Object
org.apache.pulsar.broker.transaction.buffer.impl.SnapshotSegmentAbortedTxnProcessorImpl
All Implemented Interfaces:
AbortedTxnProcessor

public class SnapshotSegmentAbortedTxnProcessorImpl extends Object implements AbortedTxnProcessor
  • Constructor Details

    • SnapshotSegmentAbortedTxnProcessorImpl

      public SnapshotSegmentAbortedTxnProcessorImpl(PersistentTopic topic)
  • Method Details

    • putAbortedTxnAndPosition

      public void putAbortedTxnAndPosition(org.apache.pulsar.client.api.transaction.TxnID txnID, Position position)
      Description copied from interface: AbortedTxnProcessor
      After the transaction buffer writes a transaction aborted marker to the topic, the transaction buffer will put the aborted txnID and the aborted marker position to AbortedTxnProcessor.
      Specified by:
      putAbortedTxnAndPosition in interface AbortedTxnProcessor
      Parameters:
      txnID - aborted transaction ID.
      position - the position of the abort txn marker.
    • checkAbortedTransaction

      public boolean checkAbortedTransaction(org.apache.pulsar.client.api.transaction.TxnID txnID)
      Description copied from interface: AbortedTxnProcessor
      Check whether the transaction ID is an aborted transaction ID.
      Specified by:
      checkAbortedTransaction in interface AbortedTxnProcessor
      Parameters:
      txnID - the transaction ID that needs to be checked.
      Returns:
      a boolean, whether the transaction ID is an aborted transaction ID.
    • trimExpiredAbortedTxns

      public void trimExpiredAbortedTxns()
      Check whether the position in segmentIndex segmentIndex is expired. If the position is not exist in the original topic, the according transaction is an invalid transaction. And the according segment is invalid, too. The transaction IDs before the transaction ID in the aborts are invalid, too.
      Specified by:
      trimExpiredAbortedTxns in interface AbortedTxnProcessor
    • takeAbortedTxnsSnapshot

      public CompletableFuture<Void> takeAbortedTxnsSnapshot(Position maxReadPosition)
      Description copied from interface: AbortedTxnProcessor
      Take aborted transactions snapshot.
      Specified by:
      takeAbortedTxnsSnapshot in interface AbortedTxnProcessor
      Returns:
      a completableFuture.
    • recoverFromSnapshot

      public CompletableFuture<Position> recoverFromSnapshot()
      Description copied from interface: AbortedTxnProcessor
      Recover transaction buffer by transaction buffer snapshot.
      Specified by:
      recoverFromSnapshot in interface AbortedTxnProcessor
      Returns:
      a Position (startReadCursorPosition) determiner where to start to recover in the original topic.
    • clearAbortedTxnSnapshot

      public CompletableFuture<Void> clearAbortedTxnSnapshot()
      Description copied from interface: AbortedTxnProcessor
      Delete the transaction buffer aborted transaction snapshot.
      Specified by:
      clearAbortedTxnSnapshot in interface AbortedTxnProcessor
      Returns:
      a completableFuture.
    • generateSnapshotStats

      public org.apache.pulsar.common.policies.data.TransactionBufferStats generateSnapshotStats(boolean segmentStats)
      Description copied from interface: AbortedTxnProcessor
      Get the lastSnapshotTimestamps.
      Specified by:
      generateSnapshotStats in interface AbortedTxnProcessor
      Returns:
      a transactionBufferStats with the stats in the abortedTxnProcessor.
    • closeAsync

      public CompletableFuture<Void> closeAsync()
      Specified by:
      closeAsync in interface AbortedTxnProcessor