Class LogMinerStreamingChangeEventSource
- java.lang.Object
-
- io.debezium.connector.oracle.logminer.LogMinerStreamingChangeEventSource
-
- All Implemented Interfaces:
ChangeEventSource,StreamingChangeEventSource<OracleOffsetContext>
public class LogMinerStreamingChangeEventSource extends Object implements StreamingChangeEventSource<OracleOffsetContext>
AStreamingChangeEventSourcebased on Oracle's LogMiner utility. The event handler loop is executed in a separate executor.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.debezium.pipeline.source.spi.ChangeEventSource
ChangeEventSource.ChangeEventSourceContext
-
-
Field Summary
Fields Modifier and Type Field Description private booleanarchiveLogOnlyModeprivate DurationarchiveLogRetentionprivate Clockclockprivate OracleConnectorConfigconnectorConfigprivate List<BigInteger>currentRedoLogSequencesprivate EventDispatcher<TableId>dispatcherprivate ScnendScnprivate ErrorHandlererrorHandlerprivate booleanisContinuousMiningprivate booleanisRacprivate JdbcConfigurationjdbcConfigurationprivate OracleConnectionjdbcConnectionprivate static org.slf4j.LoggerLOGGERprivate Set<String>racHostsprivate OracleDatabaseSchemaschemaprivate ScnstartScnprivate OracleConnectorConfig.LogMiningStrategystrategyprivate OracleStreamingChangeEventSourceMetricsstreamingMetrics
-
Constructor Summary
Constructors Constructor Description LogMinerStreamingChangeEventSource(OracleConnectorConfig connectorConfig, OracleConnection jdbcConnection, EventDispatcher<TableId> dispatcher, ErrorHandler errorHandler, Clock clock, OracleDatabaseSchema schema, Configuration jdbcConfig, OracleStreamingChangeEventSourceMetrics streamingMetrics)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidabandonOldTransactionsIfExist(OracleConnection connection, OracleOffsetContext offsetContext, TransactionalBuffer transactionalBuffer)voidcommitOffset(Map<String,?> offset)voidexecute(ChangeEventSource.ChangeEventSourceContext context, OracleOffsetContext offsetContext)This is the loop to get changes from LogMinerprivate List<BigInteger>getCurrentRedoLogSequences()Get the current redo log sequence(s).private booleanhasLogSwitchOccurred()Checks whether a database log switch has occurred and updates metrics if so.private voidinitializeRedoLogsForMining(OracleConnection connection, boolean postEndMiningSession, Duration archiveLogRetention, Scn startScn)private voidpauseBetweenMiningSessions()
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
jdbcConnection
private final OracleConnection jdbcConnection
-
dispatcher
private final EventDispatcher<TableId> dispatcher
-
clock
private final Clock clock
-
schema
private final OracleDatabaseSchema schema
-
isRac
private final boolean isRac
-
jdbcConfiguration
private final JdbcConfiguration jdbcConfiguration
-
strategy
private final OracleConnectorConfig.LogMiningStrategy strategy
-
errorHandler
private final ErrorHandler errorHandler
-
isContinuousMining
private final boolean isContinuousMining
-
streamingMetrics
private final OracleStreamingChangeEventSourceMetrics streamingMetrics
-
connectorConfig
private final OracleConnectorConfig connectorConfig
-
archiveLogRetention
private final Duration archiveLogRetention
-
archiveLogOnlyMode
private final boolean archiveLogOnlyMode
-
startScn
private Scn startScn
-
endScn
private Scn endScn
-
currentRedoLogSequences
private List<BigInteger> currentRedoLogSequences
-
-
Constructor Detail
-
LogMinerStreamingChangeEventSource
public LogMinerStreamingChangeEventSource(OracleConnectorConfig connectorConfig, OracleConnection jdbcConnection, EventDispatcher<TableId> dispatcher, ErrorHandler errorHandler, Clock clock, OracleDatabaseSchema schema, Configuration jdbcConfig, OracleStreamingChangeEventSourceMetrics streamingMetrics)
-
-
Method Detail
-
execute
public void execute(ChangeEventSource.ChangeEventSourceContext context, OracleOffsetContext offsetContext)
This is the loop to get changes from LogMiner- Specified by:
executein interfaceStreamingChangeEventSource<OracleOffsetContext>- Parameters:
context- change event source context
-
abandonOldTransactionsIfExist
private void abandonOldTransactionsIfExist(OracleConnection connection, OracleOffsetContext offsetContext, TransactionalBuffer transactionalBuffer)
-
initializeRedoLogsForMining
private void initializeRedoLogsForMining(OracleConnection connection, boolean postEndMiningSession, Duration archiveLogRetention, Scn startScn) throws SQLException
- Throws:
SQLException
-
hasLogSwitchOccurred
private boolean hasLogSwitchOccurred() throws SQLExceptionChecks whether a database log switch has occurred and updates metrics if so.- Returns:
trueif a log switch was detected, otherwisefalse- Throws:
SQLException- if a database exception occurred
-
getCurrentRedoLogSequences
private List<BigInteger> getCurrentRedoLogSequences() throws SQLException
Get the current redo log sequence(s). In an Oracle RAC environment, there are multiple current redo logs and therefore this method returns multiple values, each relating to a single RAC node in the Oracle cluster.- Returns:
- list of sequence numbers
- Throws:
SQLException- if a database exception occurred
-
pauseBetweenMiningSessions
private void pauseBetweenMiningSessions() throws InterruptedException- Throws:
InterruptedException
-
commitOffset
public void commitOffset(Map<String,?> offset)
- Specified by:
commitOffsetin interfaceStreamingChangeEventSource<OracleOffsetContext>
-
-