Class EmbeddedInfinispanLogMinerEventProcessor
java.lang.Object
io.debezium.connector.oracle.logminer.processor.AbstractLogMinerEventProcessor<InfinispanTransaction>
io.debezium.connector.oracle.logminer.processor.infinispan.AbstractInfinispanLogMinerEventProcessor
io.debezium.connector.oracle.logminer.processor.infinispan.EmbeddedInfinispanLogMinerEventProcessor
- All Implemented Interfaces:
CacheProvider,LogMinerEventProcessor,AutoCloseable
public class EmbeddedInfinispanLogMinerEventProcessor
extends AbstractInfinispanLogMinerEventProcessor
A concrete implementation of
AbstractInfinispanLogMinerEventProcessor that uses Infinispan in
embedded mode to store transaction and mined event data in caches.
The cache configurations are supplied via connector configurations and are expected to be valid XML
that represent parseable local cache setups for Infinispan.- 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 org.infinispan.manager.EmbeddedCacheManagerprivate final booleanprivate final org.infinispan.Cache<String,LogMinerEvent> private static final org.slf4j.Loggerprivate final org.infinispan.Cache<String,InfinispanTransaction> Fields inherited from class io.debezium.connector.oracle.logminer.processor.AbstractLogMinerEventProcessor
counters, sqlQueryFields 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
ConstructorsConstructorDescriptionEmbeddedInfinispanLogMinerEventProcessor(ChangeEventSource.ChangeEventSourceContext context, OracleConnectorConfig connectorConfig, OracleConnection jdbcConnection, EventDispatcher<OraclePartition, TableId> dispatcher, OraclePartition partition, OracleOffsetContext offsetContext, OracleDatabaseSchema schema, OracleStreamingChangeEventSourceMetrics metrics) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()private <K,V> org.infinispan.Cache<K, V> createCache(String cacheName, OracleConnectorConfig connectorConfig, Field field) org.infinispan.commons.api.BasicCache<String,LogMinerEvent> Get the LogMiner events cache Key - The event id, in the format oftransactionId-eventSequenceValue - The raw LogMinerEvent object instanceprotected StringReturns only the first transaction id in the transaction buffer.protected Optional<InfinispanTransaction>Get the oldest transaction in the cache.Get the processed transactions cache Key - The unique transaction id Value - The transaction's commit or rollback system change numberGet the Schema Changes cache Key - The system change number of the schema change Value - The table the schema change is related toorg.infinispan.commons.api.BasicCache<String,InfinispanTransaction> Returns theTransactionCacheimplementation.protected ScnGets the minimum system change number stored in the transaction cache.private org.infinispan.configuration.cache.ConfigurationparseAndGetConfiguration(String cacheName, String configuration) private org.infinispan.configuration.global.GlobalConfigurationparseAndGetGlobalConfiguration(OracleConnectorConfig connectorConfig) protected voidpurgeCache(Scn minCacheScn) Purge the necessary caches with all entries that occurred prior to the specified change number.Methods inherited from class io.debezium.connector.oracle.logminer.processor.infinispan.AbstractInfinispanLogMinerEventProcessor
abandonTransactions, addToTransaction, calculateNewStartScn, createQueryStatement, createTransaction, displayCacheStatistics, finalizeTransactionCommit, finalizeTransactionRollback, getAndRemoveTransactionFromCache, getTransactionEventCount, getTransactionEventIterator, handleSchemaChange, hasSchemaChangeBeenSeen, isRecentlyProcessed, processRow, removeEventWithRowId, removeIf, removeTransactionAndEventsFromCache, resetTransactionToStartMethods inherited from class io.debezium.connector.oracle.logminer.processor.AbstractLogMinerEventProcessor
abandonTransactionOverEventThreshold, getConfig, getLastProcessedScn, getLastProcessedScnChangeTime, getQueryString, getSchema, getTransactionIdPrefix, handleCommit, handleCommitNotFoundInBuffer, handleDataEvent, handleLobWrite, handleMissingScn, handleRollback, handleRollbackNotFoundInBuffer, handleSelectLobLocator, handleStart, handleUnsupportedEvent, isTransactionIdWithNoSequence, isTransactionOverEventThreshold, isTransactionUserExcluded, isTrxIdRawValue, process, processResults, warnPotentiallyStuckScn
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
cacheManager
private final org.infinispan.manager.EmbeddedCacheManager cacheManager -
dropBufferOnStop
private final boolean dropBufferOnStop -
transactionCache
-
eventCache
-
processedTransactionsCache
-
schemaChangesCache
-
-
Constructor Details
-
EmbeddedInfinispanLogMinerEventProcessor
public EmbeddedInfinispanLogMinerEventProcessor(ChangeEventSource.ChangeEventSourceContext context, OracleConnectorConfig connectorConfig, OracleConnection jdbcConnection, EventDispatcher<OraclePartition, TableId> dispatcher, OraclePartition partition, OracleOffsetContext offsetContext, OracleDatabaseSchema schema, OracleStreamingChangeEventSourceMetrics metrics)
-
-
Method Details
-
close
- Throws:
Exception
-
getTransactionCache
Description copied from class:AbstractLogMinerEventProcessorReturns theTransactionCacheimplementation.- Specified by:
getTransactionCachein interfaceCacheProvider- Specified by:
getTransactionCachein classAbstractLogMinerEventProcessor<InfinispanTransaction>- Returns:
- the transaction cache, never
null
-
getEventCache
Description copied from interface:CacheProviderGet the LogMiner events cache- Key - The event id, in the format of
transactionId-eventSequence - Value - The raw LogMinerEvent object instance
- Returns:
- the evnts cache, never
null
- Key - The event id, in the format of
-
getSchemaChangesCache
Description copied from interface:CacheProviderGet the Schema Changes cache- Key - The system change number of the schema change
- Value - The table the schema change is related to
- Returns:
- the schema changes cache, never
null
-
getProcessedTransactionsCache
Description copied from interface:CacheProviderGet the processed transactions cache- Key - The unique transaction id
- Value - The transaction's commit or rollback system change number
- Returns:
- the processed transactions cache, never
null
-
getTransactionCacheMinimumScn
Description copied from class:AbstractLogMinerEventProcessorGets the minimum system change number stored in the transaction cache.- Specified by:
getTransactionCacheMinimumScnin classAbstractLogMinerEventProcessor<InfinispanTransaction>- 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<InfinispanTransaction>- Returns:
- the oldest transaction in the cache or maybe
nullif cache is empty
-
getFirstActiveTransactionKey
Description copied from class:AbstractLogMinerEventProcessorReturns only the first transaction id in the transaction buffer.- Specified by:
getFirstActiveTransactionKeyin classAbstractLogMinerEventProcessor<InfinispanTransaction>- Returns:
- the first active transaction in the buffer, or
nullif there is none.
-
purgeCache
Description copied from class:AbstractInfinispanLogMinerEventProcessorPurge the necessary caches with all entries that occurred prior to the specified change number. NOTE: This method is abstract despite the code used by both all implementations being identical. This is because the method neededentrySet()is made available on two different concrete interfaces between the embedded and remote cache implementations, and therefore we need to access this method from the concrete implementation classes (RemoteCache and Cache) rather than from the common class used by CacheProvider (BasicCache).- Specified by:
purgeCachein classAbstractInfinispanLogMinerEventProcessor- Parameters:
minCacheScn- the minimum system change number to keep entries until
-
createCache
private <K,V> org.infinispan.Cache<K,V> createCache(String cacheName, OracleConnectorConfig connectorConfig, Field field) -
parseAndGetConfiguration
-
parseAndGetGlobalConfiguration
private org.infinispan.configuration.global.GlobalConfiguration parseAndGetGlobalConfiguration(OracleConnectorConfig connectorConfig)
-