Class AbstractInfinispanLogMinerEventProcessor
java.lang.Object
io.debezium.connector.oracle.logminer.processor.AbstractLogMinerEventProcessor<InfinispanTransaction>
io.debezium.connector.oracle.logminer.processor.infinispan.AbstractInfinispanLogMinerEventProcessor
- All Implemented Interfaces:
CacheProvider,LogMinerEventProcessor,AutoCloseable
- Direct Known Subclasses:
EmbeddedInfinispanLogMinerEventProcessor,RemoteInfinispanLogMinerEventProcessor
public abstract class AbstractInfinispanLogMinerEventProcessor
extends AbstractLogMinerEventProcessor<InfinispanTransaction>
implements CacheProvider
An implementation of
LogMinerEventProcessor
that uses Infinispan to persist the transaction cache across restarts on disk.- Author:
- Chris Cranford
-
Nested Class Summary
Nested classes/interfaces inherited from class io.debezium.connector.oracle.logminer.processor.AbstractLogMinerEventProcessor
AbstractLogMinerEventProcessor.Counters -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final EventDispatcher<OraclePartition,TableId> private final OracleConnectionprivate static final org.slf4j.Loggerprivate final OracleStreamingChangeEventSourceMetricsprivate final OracleOffsetContextprivate final OraclePartitionFields inherited from class io.debezium.connector.oracle.logminer.processor.AbstractLogMinerEventProcessor
countersFields inherited from interface io.debezium.connector.oracle.logminer.processor.infinispan.CacheProvider
EVENTS_CACHE_NAME, PROCESSED_TRANSACTIONS_CACHE_NAME, SCHEMA_CHANGES_CACHE_NAME, TRANSACTIONS_CACHE_NAME -
Constructor Summary
ConstructorsConstructorDescriptionAbstractInfinispanLogMinerEventProcessor(ChangeEventSource.ChangeEventSourceContext context, OracleConnectorConfig connectorConfig, OracleConnection jdbcConnection, EventDispatcher<OraclePartition, TableId> dispatcher, OraclePartition partition, OracleOffsetContext offsetContext, OracleDatabaseSchema schema, OracleStreamingChangeEventSourceMetrics metrics) -
Method Summary
Modifier and TypeMethodDescriptionvoidabandonTransactions(Duration retention) A callback for the event processor to abandon long running transactions.protected voidaddToTransaction(String transactionId, LogMinerEventRow row, Supplier<LogMinerEvent> eventSupplier) Add a transaction to the transaction map if allowed.protected ScncalculateNewStartScn(Scn endScn, Scn maxCommittedScn) Calculates the new starting system change number based on the current processing range.protected PreparedStatementCreate the JDBC query that will be used to fetch the mining result set.protected InfinispanTransactionCreates a new transaction based on the suppliedSTARTevent.voidDisplays cache statisticsprotected voidfinalizeTransactionCommit(String transactionId, Scn commitScn) Finalizes the commit of a transaction.protected voidfinalizeTransactionRollback(String transactionId, Scn rollbackScn) Finalizes the rollback the specified transactionprotected InfinispanTransactiongetAndRemoveTransactionFromCache(String transactionId) Gets a transaction instance from the transaction cache while also removing its cache entry.protected intgetTransactionEventCount(InfinispanTransaction transaction) Returns the number of events associated with the specified transaction.protected Iterator<LogMinerEvent>getTransactionEventIterator(InfinispanTransaction transaction) Get an iterator over the events that are part of the specified transaction.getTransactionKeysWithPrefix(String prefix) protected voidHandle processing a LogMinerEventRow for aDDLevent.protected booleanChecks whether the LogMinerEvent row for a schema change can be emitted.protected booleanisRecentlyProcessed(String transactionId) Check whether a transaction has been recently processed through either a commit or rollback.protected voidprocessRow(OraclePartition partition, LogMinerEventRow row) Processes a single LogMinerEventRow.private voidremoveEventsWithTransaction(InfinispanTransaction transaction) protected voidRemoves a specific transaction event by database row identifier.protected voidremoveTransactionAndEventsFromCache(InfinispanTransaction transaction) Removes the transaction and all its associated event entries from the connector's caches.Methods inherited from class io.debezium.connector.oracle.logminer.processor.AbstractLogMinerEventProcessor
abandonTransactionOverEventThreshold, getConfig, getLastProcessedScn, getSchema, getTransactionCache, getTransactionCacheMinimumScn, getTransactionIdPrefix, handleCommit, handleDataEvent, handleLobWrite, handleMissingScn, handleRollback, handleSelectLobLocator, handleStart, handleUnsupportedEvent, isTransactionIdWithNoSequence, isTransactionOverEventThreshold, isTransactionUserExcluded, isTrxIdRawValue, process, processResults, warnPotentiallyStuckScnMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.AutoCloseable
closeMethods inherited from interface io.debezium.connector.oracle.logminer.processor.infinispan.CacheProvider
getEventCache, getProcessedTransactionsCache, getSchemaChangesCache, getTransactionCache
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
jdbcConnection
-
metrics
-
partition
-
offsetContext
-
dispatcher
-
-
Constructor Details
-
AbstractInfinispanLogMinerEventProcessor
public AbstractInfinispanLogMinerEventProcessor(ChangeEventSource.ChangeEventSourceContext context, OracleConnectorConfig connectorConfig, OracleConnection jdbcConnection, EventDispatcher<OraclePartition, TableId> dispatcher, OraclePartition partition, OracleOffsetContext offsetContext, OracleDatabaseSchema schema, OracleStreamingChangeEventSourceMetrics metrics)
-
-
Method Details
-
displayCacheStatistics
public void displayCacheStatistics()Description copied from interface:CacheProviderDisplays cache statistics- Specified by:
displayCacheStatisticsin interfaceCacheProvider
-
isRecentlyProcessed
Description copied from class:AbstractLogMinerEventProcessorCheck whether a transaction has been recently processed through either a commit or rollback.- Overrides:
isRecentlyProcessedin classAbstractLogMinerEventProcessor<InfinispanTransaction>- Parameters:
transactionId- the unique transaction id- Returns:
- true if the transaction has been recently processed, false otherwise
-
createTransaction
Description copied from class:AbstractLogMinerEventProcessorCreates a new transaction based on the suppliedSTARTevent.- Specified by:
createTransactionin classAbstractLogMinerEventProcessor<InfinispanTransaction>- Parameters:
row- the event row, must not benull- Returns:
- the implementation-specific
Transactioninstance
-
removeEventWithRowId
Description copied from class:AbstractLogMinerEventProcessorRemoves a specific transaction event by database row identifier.- Specified by:
removeEventWithRowIdin classAbstractLogMinerEventProcessor<InfinispanTransaction>- Parameters:
row- the event row that contains the row identifier, must not benull
-
getTransactionKeysWithPrefix
-
processRow
protected void processRow(OraclePartition partition, LogMinerEventRow row) throws SQLException, InterruptedException Description copied from class:AbstractLogMinerEventProcessorProcesses a single LogMinerEventRow.- Overrides:
processRowin classAbstractLogMinerEventProcessor<InfinispanTransaction>row- the event row, must not benull- Throws:
SQLException- if a database exception occurredInterruptedException- if the dispatcher was interrupted sending an event
-
abandonTransactions
Description copied from interface:LogMinerEventProcessorA callback for the event processor to abandon long running transactions.- Specified by:
abandonTransactionsin interfaceLogMinerEventProcessor- Parameters:
retention- the maximum duration in which long running transactions are allowed.- Throws:
InterruptedException
-
hasSchemaChangeBeenSeen
Description copied from class:AbstractLogMinerEventProcessorChecks whether the LogMinerEvent row for a schema change can be emitted.- Overrides:
hasSchemaChangeBeenSeenin classAbstractLogMinerEventProcessor<InfinispanTransaction>- Parameters:
row- the result set row- Returns:
- true if the schema change has been seen, false otherwise.
-
getAndRemoveTransactionFromCache
Description copied from class:AbstractLogMinerEventProcessorGets a transaction instance from the transaction cache while also removing its cache entry.- Specified by:
getAndRemoveTransactionFromCachein classAbstractLogMinerEventProcessor<InfinispanTransaction>- Parameters:
transactionId- the transaction's unique identifier, should not benull- Returns:
- the transaction instance if found,
nullif the transaction wasn't found
-
removeTransactionAndEventsFromCache
Description copied from class:AbstractLogMinerEventProcessorRemoves the transaction and all its associated event entries from the connector's caches.- Specified by:
removeTransactionAndEventsFromCachein classAbstractLogMinerEventProcessor<InfinispanTransaction>- Parameters:
transaction- the transaction instance, should never benull
-
getTransactionEventIterator
Description copied from class:AbstractLogMinerEventProcessorGet an iterator over the events that are part of the specified transaction.- Specified by:
getTransactionEventIteratorin classAbstractLogMinerEventProcessor<InfinispanTransaction>- Parameters:
transaction- the transaction instance, should never benull- Returns:
- an iterator over the transaction's events, never
null
-
finalizeTransactionCommit
Description copied from class:AbstractLogMinerEventProcessorFinalizes the commit of a transaction.- Specified by:
finalizeTransactionCommitin classAbstractLogMinerEventProcessor<InfinispanTransaction>- Parameters:
transactionId- the transaction's unique identifier, should not benullcommitScn- the transaction's system change number, should not benull
-
finalizeTransactionRollback
Description copied from class:AbstractLogMinerEventProcessorFinalizes the rollback the specified transaction- Specified by:
finalizeTransactionRollbackin classAbstractLogMinerEventProcessor<InfinispanTransaction>- Parameters:
transactionId- the unique transaction identifier, nevernullrollbackScn- the rollback transaction's system change number, nevernull
-
handleSchemaChange
Description copied from class:AbstractLogMinerEventProcessorHandle processing a LogMinerEventRow for aDDLevent.- Overrides:
handleSchemaChangein classAbstractLogMinerEventProcessor<InfinispanTransaction>- Parameters:
row- the result set row- Throws:
InterruptedException- if the event dispatcher is interrupted sending the event
-
addToTransaction
protected void addToTransaction(String transactionId, LogMinerEventRow row, Supplier<LogMinerEvent> eventSupplier) Description copied from class:AbstractLogMinerEventProcessorAdd a transaction to the transaction map if allowed.- Specified by:
addToTransactionin classAbstractLogMinerEventProcessor<InfinispanTransaction>- Parameters:
transactionId- the unqiue transaction idrow- the LogMiner event roweventSupplier- the supplier of the event to create if the event is allowed to be added
-
getTransactionEventCount
Description copied from class:AbstractLogMinerEventProcessorReturns the number of events associated with the specified transaction.- Specified by:
getTransactionEventCountin classAbstractLogMinerEventProcessor<InfinispanTransaction>- Parameters:
transaction- the transaction, must not benull- Returns:
- the number of events in the transaction
-
createQueryStatement
Description copied from class:AbstractLogMinerEventProcessorCreate the JDBC query that will be used to fetch the mining result set.- Specified by:
createQueryStatementin classAbstractLogMinerEventProcessor<InfinispanTransaction>- Returns:
- a prepared query statement, never
null - Throws:
SQLException- if a database exception occurred creating the statement
-
calculateNewStartScn
Description copied from class:AbstractLogMinerEventProcessorCalculates the new starting system change number based on the current processing range.- Specified by:
calculateNewStartScnin classAbstractLogMinerEventProcessor<InfinispanTransaction>- Parameters:
endScn- the end system change number for the previously mined range, nevernullmaxCommittedScn- the maximum committed system change number, nevernull- Returns:
- the system change number to start then next mining iteration from, never
null - Throws:
InterruptedException- if the current thread is interrupted
-
removeEventsWithTransaction
-