Package io.debezium.connector.mysql
Class MySqlStreamingChangeEventSource
java.lang.Object
io.debezium.connector.binlog.BinlogStreamingChangeEventSource<MySqlPartition,MySqlOffsetContext>
io.debezium.connector.mysql.MySqlStreamingChangeEventSource
- All Implemented Interfaces:
ChangeEventSource,StreamingChangeEventSource<MySqlPartition,MySqlOffsetContext>
public class MySqlStreamingChangeEventSource
extends BinlogStreamingChangeEventSource<MySqlPartition,MySqlOffsetContext>
- Author:
- Jiri Pechanec
-
Nested Class Summary
Nested classes/interfaces inherited from class io.debezium.connector.binlog.BinlogStreamingChangeEventSource
BinlogStreamingChangeEventSource.BinlogPosition, BinlogStreamingChangeEventSource.ReaderThreadLifecycleListenerNested classes/interfaces inherited from interface io.debezium.pipeline.source.spi.ChangeEventSource
ChangeEventSource.ChangeEventSourceContext -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MySqlConnectorConfigprivate com.github.shyiko.mysql.binlog.GtidSetprivate static final org.slf4j.LoggerFields inherited from class io.debezium.connector.binlog.BinlogStreamingChangeEventSource
eventTimestamp -
Constructor Summary
ConstructorsConstructorDescriptionMySqlStreamingChangeEventSource(MySqlConnectorConfig connectorConfig, BinlogConnectorConnection connection, EventDispatcher<MySqlPartition, TableId> dispatcher, ErrorHandler errorHandler, Clock clock, MySqlTaskContext taskContext, MySqlStreamingChangeEventSourceMetrics metrics, SnapshotterService snapshotterService) -
Method Summary
Modifier and TypeMethodDescriptionprotected Class<? extends org.apache.kafka.connect.source.SourceConnector>protected com.github.shyiko.mysql.binlog.event.EventTypeprotected com.github.shyiko.mysql.binlog.event.EventTypeprotected voidhandleGtidEvent(MySqlPartition partition, MySqlOffsetContext offsetContext, com.github.shyiko.mysql.binlog.event.Event event, Predicate<String> gtidSourceFilter) Handle the supplied event with aGtidEventDatathat signals the beginning of a GTID transaction.protected voidhandleRecordingQuery(MySqlOffsetContext offsetContext, com.github.shyiko.mysql.binlog.event.Event event) Handle the supplied event with anRowsQueryEventDataorAnnotateRowsEventDataby recording the original SQL query that generated the event.voidinit(MySqlOffsetContext offsetContext) protected voidinitializeGtidSet(String value) protected voidsetEventTimestamp(com.github.shyiko.mysql.binlog.event.Event event, long eventTs) Methods inherited from class io.debezium.connector.binlog.BinlogStreamingChangeEventSource
configureReplicaCompatibility, createBinaryLogClient, createEventDeserializer, execute, getOffsetContext, handleDelete, handleEvent, handleInsert, handleQueryEvent, handleRotateLogsEvent, handleServerHeartbeat, handleServerIncident, handleServerStop, handleTransactionBegin, handleTransactionPayload, handleUpdate, handleUpdateTableMetadata, ignoreEvent, isGtidModeEnabled, logEvent, onEvent, prepareTransaction, setEffectiveOffsetContext, setGtidChanged, setIgnoreDmlEventByGtidSource, unwrapData, viewChange, wrapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.debezium.pipeline.source.spi.StreamingChangeEventSource
commitOffset, executeIteration
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
connectorConfig
-
gtidSet
private com.github.shyiko.mysql.binlog.GtidSet gtidSet
-
-
Constructor Details
-
MySqlStreamingChangeEventSource
public MySqlStreamingChangeEventSource(MySqlConnectorConfig connectorConfig, BinlogConnectorConnection connection, EventDispatcher<MySqlPartition, TableId> dispatcher, ErrorHandler errorHandler, Clock clock, MySqlTaskContext taskContext, MySqlStreamingChangeEventSourceMetrics metrics, SnapshotterService snapshotterService)
-
-
Method Details
-
setEventTimestamp
protected void setEventTimestamp(com.github.shyiko.mysql.binlog.event.Event event, long eventTs) - Specified by:
setEventTimestampin classBinlogStreamingChangeEventSource<MySqlPartition,MySqlOffsetContext>
-
handleGtidEvent
protected void handleGtidEvent(MySqlPartition partition, MySqlOffsetContext offsetContext, com.github.shyiko.mysql.binlog.event.Event event, Predicate<String> gtidSourceFilter) Handle the supplied event with aGtidEventDatathat signals the beginning of a GTID transaction. We don't yet know whether this transaction contains any events we're interested in, but we have to record it so that we know the position of this event and know we've processed the binlog to this point.Note that this captures the current GTID and complete GTID set, regardless of whether the connector is
filteringthe GTID set upon connection. We do this because we actually want to capture all GTID set values found in the binlog, whether or not we process them. However, only when we connect do we actually want to pass to MySQL only those GTID ranges that are applicable per the configuration.- Specified by:
handleGtidEventin classBinlogStreamingChangeEventSource<MySqlPartition,MySqlOffsetContext> - Parameters:
partition- the partition; never nulloffsetContext- the offset context; never nullevent- the GTID event to be processed; may not be nullgtidSourceFilter- the GTID source filter
-
handleRecordingQuery
protected void handleRecordingQuery(MySqlOffsetContext offsetContext, com.github.shyiko.mysql.binlog.event.Event event) Handle the supplied event with anRowsQueryEventDataorAnnotateRowsEventDataby recording the original SQL query that generated the event.- Specified by:
handleRecordingQueryin classBinlogStreamingChangeEventSource<MySqlPartition,MySqlOffsetContext> - Parameters:
event- the database change data event to be processed; may not be null
-
init
-
getConnectorClass
- Specified by:
getConnectorClassin classBinlogStreamingChangeEventSource<MySqlPartition,MySqlOffsetContext>
-
getIncludeQueryEventType
protected com.github.shyiko.mysql.binlog.event.EventType getIncludeQueryEventType()- Specified by:
getIncludeQueryEventTypein classBinlogStreamingChangeEventSource<MySqlPartition,MySqlOffsetContext>
-
getGtidEventType
protected com.github.shyiko.mysql.binlog.event.EventType getGtidEventType()- Specified by:
getGtidEventTypein classBinlogStreamingChangeEventSource<MySqlPartition,MySqlOffsetContext>
-
initializeGtidSet
- Specified by:
initializeGtidSetin classBinlogStreamingChangeEventSource<MySqlPartition,MySqlOffsetContext>
-