Class LogMinerAdapter
java.lang.Object
io.debezium.connector.oracle.AbstractStreamingAdapter<LogMinerStreamingChangeEventSourceMetrics>
io.debezium.connector.oracle.logminer.LogMinerAdapter
- All Implemented Interfaces:
StreamingAdapter<LogMinerStreamingChangeEventSourceMetrics>
public class LogMinerAdapter
extends AbstractStreamingAdapter<LogMinerStreamingChangeEventSourceMetrics>
- Author:
- Chris Cranford
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.debezium.connector.oracle.StreamingAdapter
StreamingAdapter.TableNameCaseSensitivity -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final Durationprivate static final org.slf4j.Loggerstatic final StringFields inherited from class io.debezium.connector.oracle.AbstractStreamingAdapter
connectorConfig -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddLogsToSession(List<LogFile> logs, OracleConnection connection) copyOffset(OracleConnectorConfig connectorConfig, OracleOffsetContext offsetContext) Creates a copy of the existing offsets.private OracleOffsetContextdetermineSnapshotOffset(OracleConnectorConfig connectorConfig, OracleConnection connection, Scn currentScn, Map<String, Scn> pendingTransactions, String transactionTableName) determineSnapshotOffset(RelationalSnapshotChangeEventSource.RelationalSnapshotContext<OraclePartition, OracleOffsetContext> ctx, OracleConnectorConfig connectorConfig, OracleConnection connection) Returns the offset context based on the snapshot state.getCurrentScn(Scn latestTableDdlScn, OracleConnection connection) getMostRecentLogFilesForSearch(List<LogFile> allLogFiles) getOffsetScn(OracleOffsetContext offsetContext) Returns the Scn stored in the offset.private ScngetOldestScnAvailableInLogs(OracleConnectorConfig config, OracleConnection connection) getOrderedLogsFromScn(OracleConnectorConfig config, Scn sinceScn, OracleConnection connection) getPendingTransactions(Scn latestTableDdlScn, OracleConnection connection, Map<String, Scn> transactions, String transactionTableName) private voidgetPendingTransactionsFromLogs(OracleConnection connection, Scn currentScn, Map<String, Scn> pendingTransactions) getSource(OracleConnection connection, EventDispatcher<OraclePartition, TableId> dispatcher, ErrorHandler errorHandler, Clock clock, OracleDatabaseSchema schema, OracleTaskContext taskContext, Configuration jdbcConfig, LogMinerStreamingChangeEventSourceMetrics streamingMetrics, SnapshotterService snapshotterService) getStreamingMetrics(OracleTaskContext taskContext, ChangeEventQueueMetrics changeEventQueueMetrics, EventMetadataProvider metadataProvider, OracleConnectorConfig connectorConfig) private static StringUnder Oracle RAC, the V$ tables are specific the node that the JDBC connection is established to and not every V$ is synchronized across the cluster.getType()private booleanbooleanprivate voidstartSession(OracleConnection connection) private voidstopSession(OracleConnection connection) Methods inherited from class io.debezium.connector.oracle.AbstractStreamingAdapter
areSameTimestamp, getLatestTableDdlScn, resolveScnMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.debezium.connector.oracle.StreamingAdapter
getTableNameCaseSensitivity, getValueConverter
-
Field Details
-
GET_TRANSACTION_SCN_PAUSE
-
GET_TRANSACTION_SCN_ATTEMPTS
private static final int GET_TRANSACTION_SCN_ATTEMPTS- See Also:
-
LOGGER
private static final org.slf4j.Logger LOGGER -
TYPE
- See Also:
-
-
Constructor Details
-
LogMinerAdapter
-
-
Method Details
-
getType
-
getHistoryRecordComparator
-
getOffsetContextLoader
-
getSource
public StreamingChangeEventSource<OraclePartition,OracleOffsetContext> getSource(OracleConnection connection, EventDispatcher<OraclePartition, TableId> dispatcher, ErrorHandler errorHandler, Clock clock, OracleDatabaseSchema schema, OracleTaskContext taskContext, Configuration jdbcConfig, LogMinerStreamingChangeEventSourceMetrics streamingMetrics, SnapshotterService snapshotterService) -
getStreamingMetrics
public LogMinerStreamingChangeEventSourceMetrics getStreamingMetrics(OracleTaskContext taskContext, ChangeEventQueueMetrics changeEventQueueMetrics, EventMetadataProvider metadataProvider, OracleConnectorConfig connectorConfig) -
determineSnapshotOffset
public OracleOffsetContext determineSnapshotOffset(RelationalSnapshotChangeEventSource.RelationalSnapshotContext<OraclePartition, OracleOffsetContext> ctx, OracleConnectorConfig connectorConfig, OracleConnection connection) throws SQLExceptionDescription copied from interface:StreamingAdapterReturns the offset context based on the snapshot state.- Parameters:
ctx- the relational snapshot context, should never benullconnectorConfig- the connector configuration, should never benullconnection- the database connection, should never benull- Returns:
- the offset context, never
null - Throws:
SQLException- if a database error occurred
-
getOffsetScn
Description copied from interface:StreamingAdapterReturns the Scn stored in the offset.- Parameters:
offsetContext- the connector offset context- Returns:
- the
Scnstored in the offset
-
copyOffset
public OracleOffsetContext copyOffset(OracleConnectorConfig connectorConfig, OracleOffsetContext offsetContext) Description copied from interface:StreamingAdapterCreates a copy of the existing offsets.- Parameters:
connectorConfig- the connector configuration, should never benulloffsetContext- the current offset context, should never benull- Returns:
- a copy of the offset context for this adapter
-
getCurrentScn
private Optional<Scn> getCurrentScn(Scn latestTableDdlScn, OracleConnection connection) throws SQLException - Throws:
SQLException
-
getPendingTransactions
private Optional<Scn> getPendingTransactions(Scn latestTableDdlScn, OracleConnection connection, Map<String, Scn> transactions, String transactionTableName) throws SQLException- Throws:
SQLException
-
determineSnapshotOffset
private OracleOffsetContext determineSnapshotOffset(OracleConnectorConfig connectorConfig, OracleConnection connection, Scn currentScn, Map<String, Scn> pendingTransactions, String transactionTableName) throws SQLException- Throws:
SQLException
-
addLogsToSession
- Throws:
SQLException
-
startSession
- Throws:
SQLException
-
stopSession
- Throws:
SQLException
-
getOldestScnAvailableInLogs
private Scn getOldestScnAvailableInLogs(OracleConnectorConfig config, OracleConnection connection) throws SQLException - Throws:
SQLException
-
getOrderedLogsFromScn
private List<LogFile> getOrderedLogsFromScn(OracleConnectorConfig config, Scn sinceScn, OracleConnection connection) throws SQLException - Throws:
SQLException
-
getPendingTransactionsFromLogs
private void getPendingTransactionsFromLogs(OracleConnection connection, Scn currentScn, Map<String, Scn> pendingTransactions) throws SQLException- Throws:
SQLException
-
getMostRecentLogFilesForSearch
-
isPendingTransactionSkip
-
isPendingTransactionViewOnly
-
getTransactionTableName
Under Oracle RAC, the V$ tables are specific the node that the JDBC connection is established to and not every V$ is synchronized across the cluster. Therefore, when Oracle RAC is in play, we should use the GV$ tables instead.- Parameters:
config- the connector configuration, should not benull- Returns:
- the pending transaction table name
-