Class SnapshotSegmentAbortedTxnProcessorImpl
java.lang.Object
org.apache.pulsar.broker.transaction.buffer.impl.SnapshotSegmentAbortedTxnProcessorImpl
- All Implemented Interfaces:
AbortedTxnProcessor
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassThe PersistentWorker be responsible for executing the persistent tasks, including:Nested classes/interfaces inherited from interface org.apache.pulsar.broker.transaction.buffer.AbortedTxnProcessor
AbortedTxnProcessor.SnapshotType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckAbortedTransaction(org.apache.pulsar.client.api.transaction.TxnID txnID) Check whether the transaction ID is an aborted transaction ID.Delete the transaction buffer aborted transaction snapshot.org.apache.pulsar.common.policies.data.TransactionBufferStatsgenerateSnapshotStats(boolean segmentStats) Get the lastSnapshotTimestamps.voidputAbortedTxnAndPosition(org.apache.pulsar.client.api.transaction.TxnID txnID, Position position) 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.Recover transaction buffer by transaction buffer snapshot.takeAbortedTxnsSnapshot(Position maxReadPosition) Take aborted transactions snapshot.voidCheck whether the position in segmentIndexsegmentIndexis expired.
-
Constructor Details
-
SnapshotSegmentAbortedTxnProcessorImpl
-
-
Method Details
-
putAbortedTxnAndPosition
public void putAbortedTxnAndPosition(org.apache.pulsar.client.api.transaction.TxnID txnID, Position position) Description copied from interface:AbortedTxnProcessorAfter 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:
putAbortedTxnAndPositionin interfaceAbortedTxnProcessor- 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:AbortedTxnProcessorCheck whether the transaction ID is an aborted transaction ID.- Specified by:
checkAbortedTransactionin interfaceAbortedTxnProcessor- 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 segmentIndexsegmentIndexis 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:
trimExpiredAbortedTxnsin interfaceAbortedTxnProcessor
-
takeAbortedTxnsSnapshot
Description copied from interface:AbortedTxnProcessorTake aborted transactions snapshot.- Specified by:
takeAbortedTxnsSnapshotin interfaceAbortedTxnProcessor- Returns:
- a completableFuture.
-
recoverFromSnapshot
Description copied from interface:AbortedTxnProcessorRecover transaction buffer by transaction buffer snapshot.- Specified by:
recoverFromSnapshotin interfaceAbortedTxnProcessor- Returns:
- a Position (startReadCursorPosition) determiner where to start to recover in the original topic.
-
clearAbortedTxnSnapshot
Description copied from interface:AbortedTxnProcessorDelete the transaction buffer aborted transaction snapshot.- Specified by:
clearAbortedTxnSnapshotin interfaceAbortedTxnProcessor- Returns:
- a completableFuture.
-
generateSnapshotStats
public org.apache.pulsar.common.policies.data.TransactionBufferStats generateSnapshotStats(boolean segmentStats) Description copied from interface:AbortedTxnProcessorGet the lastSnapshotTimestamps.- Specified by:
generateSnapshotStatsin interfaceAbortedTxnProcessor- Returns:
- a transactionBufferStats with the stats in the abortedTxnProcessor.
-
closeAsync
- Specified by:
closeAsyncin interfaceAbortedTxnProcessor
-