Class MemoryLogMinerEventProcessor
java.lang.Object
io.debezium.connector.oracle.logminer.processor.AbstractLogMinerEventProcessor<MemoryTransaction>
io.debezium.connector.oracle.logminer.processor.memory.MemoryLogMinerEventProcessor
- All Implemented Interfaces:
LogMinerEventProcessor,AutoCloseable
A
LogMinerEventProcessor that uses the JVM heap to store events as they're being
processed and emitted from Oracle LogMiner.- 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 static final org.slf4j.Loggerprivate final LogMinerStreamingChangeEventSourceMetricsprivate final OracleOffsetContextprivate final OraclePartitionCache of processed transactions (committed or rolled back), keyed based on the transaction's unique identifier.private final Map<String,MemoryTransaction> Cache of transactions, keyed based on the transaction's unique identifierFields inherited from class io.debezium.connector.oracle.logminer.processor.AbstractLogMinerEventProcessor
counters, jdbcConnection, sqlQuery -
Constructor Summary
ConstructorsConstructorDescriptionMemoryLogMinerEventProcessor(ChangeEventSource.ChangeEventSourceContext context, OracleConnectorConfig connectorConfig, OracleConnection jdbcConnection, EventDispatcher<OraclePartition, TableId> dispatcher, OraclePartition partition, OracleOffsetContext offsetContext, OracleDatabaseSchema schema, LogMinerStreamingChangeEventSourceMetrics metrics) -
Method Summary
Modifier and TypeMethodDescriptionprotected 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.voidclose()protected PreparedStatementCreate the JDBC query that will be used to fetch the mining result set.protected MemoryTransactionCreates a new transaction based on the suppliedSTARTevent.protected voidfinalizeTransactionCommit(String transactionId, Scn commitScn) Finalizes the commit of a transaction.protected voidfinalizeTransactionRollback(String transactionId, Scn rollbackScn) Finalizes the rollback the specified transactionprotected MemoryTransactiongetAndRemoveTransactionFromCache(String transactionId) Gets a transaction instance from the transaction cache while also removing its cache entry.protected StringReturns only the first transaction id in the transaction buffer.protected Optional<MemoryTransaction>Get the oldest transaction in the cache.protected Map<String,MemoryTransaction> Returns theTransactionCacheimplementation.protected ScnGets the minimum system change number stored in the transaction cache.protected intgetTransactionEventCount(MemoryTransaction transaction) Returns the number of events associated with the specified transaction.protected Iterator<LogMinerEvent>getTransactionEventIterator(MemoryTransaction transaction) Get an iterator over the events that are part of the specified transaction.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 voidRemoves a specific transaction event by database row identifier.Methods inherited from class io.debezium.connector.oracle.logminer.processor.AbstractLogMinerEventProcessor
abandonTransactionOverEventThreshold, abandonTransactions, cleanupAfterTransactionRemovedFromCache, dispatchSchemaChangeEventAndGetTableForNewCapturedTable, getAbandonedTransactionsCache, getConfig, getLastProcessedScn, getLastProcessedScnChangeTime, getLastScnToAbandon, getQueryString, getSchema, getTableMetadataDdl, getTransactionIdPrefix, handleCommit, handleCommitNotFoundInBuffer, handleDataEvent, handleLobWrite, handleMissingScn, handleRollback, handleRollbackNotFoundInBuffer, handleSelectLobLocator, handleStart, handleUnsupportedEvent, isTransactionIdWithNoSequence, isTransactionOverEventThreshold, isTransactionUserExcluded, isTrxIdRawValue, process, processResults, processRow, resetTransactionToStart, warnPotentiallyStuckScn
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
dispatcher
-
partition
-
offsetContext
-
metrics
-
transactionCache
Cache of transactions, keyed based on the transaction's unique identifier -
recentlyProcessedTransactionsCache
Cache of processed transactions (committed or rolled back), keyed based on the transaction's unique identifier. -
schemaChangesCache
-
-
Constructor Details
-
MemoryLogMinerEventProcessor
public MemoryLogMinerEventProcessor(ChangeEventSource.ChangeEventSourceContext context, OracleConnectorConfig connectorConfig, OracleConnection jdbcConnection, EventDispatcher<OraclePartition, TableId> dispatcher, OraclePartition partition, OracleOffsetContext offsetContext, OracleDatabaseSchema schema, LogMinerStreamingChangeEventSourceMetrics metrics)
-
-
Method Details
-
getTransactionCache
Description copied from class:AbstractLogMinerEventProcessorReturns theTransactionCacheimplementation.- Specified by:
getTransactionCachein classAbstractLogMinerEventProcessor<MemoryTransaction>- Returns:
- the transaction cache, never
null
-
createTransaction
Description copied from class:AbstractLogMinerEventProcessorCreates a new transaction based on the suppliedSTARTevent.- Specified by:
createTransactionin classAbstractLogMinerEventProcessor<MemoryTransaction>- 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<MemoryTransaction>- Parameters:
row- the event row that contains the row identifier, must not benull
-
close
- Throws:
Exception
-
isRecentlyProcessed
Description copied from class:AbstractLogMinerEventProcessorCheck whether a transaction has been recently processed through either a commit or rollback.- Overrides:
isRecentlyProcessedin classAbstractLogMinerEventProcessor<MemoryTransaction>- Parameters:
transactionId- the unique transaction id- Returns:
- true if the transaction has been recently processed, false otherwise
-
hasSchemaChangeBeenSeen
Description copied from class:AbstractLogMinerEventProcessorChecks whether the LogMinerEvent row for a schema change can be emitted.- Overrides:
hasSchemaChangeBeenSeenin classAbstractLogMinerEventProcessor<MemoryTransaction>- 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<MemoryTransaction>- Parameters:
transactionId- the transaction's unique identifier, should not benull- Returns:
- the transaction instance if found,
nullif the transaction wasn't found
-
getTransactionEventIterator
Description copied from class:AbstractLogMinerEventProcessorGet an iterator over the events that are part of the specified transaction.- Specified by:
getTransactionEventIteratorin classAbstractLogMinerEventProcessor<MemoryTransaction>- 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<MemoryTransaction>- 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<MemoryTransaction>- Parameters:
transactionId- the unique transaction identifier, nevernullrollbackScn- the rollback transaction's system change number, nevernull
-
getFirstActiveTransactionKey
Description copied from class:AbstractLogMinerEventProcessorReturns only the first transaction id in the transaction buffer.- Specified by:
getFirstActiveTransactionKeyin classAbstractLogMinerEventProcessor<MemoryTransaction>- Returns:
- the first active transaction in the buffer, or
nullif there is none.
-
handleSchemaChange
Description copied from class:AbstractLogMinerEventProcessorHandle processing a LogMinerEventRow for aDDLevent.- Overrides:
handleSchemaChangein classAbstractLogMinerEventProcessor<MemoryTransaction>- 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<MemoryTransaction>- 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<MemoryTransaction>- 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<MemoryTransaction>- 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<MemoryTransaction>- 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
-
getTransactionCacheMinimumScn
Description copied from class:AbstractLogMinerEventProcessorGets the minimum system change number stored in the transaction cache.- Specified by:
getTransactionCacheMinimumScnin classAbstractLogMinerEventProcessor<MemoryTransaction>- Returns:
- the minimum system change number, never
nullbut could beScn.NULL.
-
getOldestTransactionInCache
Description copied from class:AbstractLogMinerEventProcessorGet the oldest transaction in the cache.- Specified by:
getOldestTransactionInCachein classAbstractLogMinerEventProcessor<MemoryTransaction>- Returns:
- the oldest transaction in the cache or maybe
nullif cache is empty
-