public class BinlogReader extends AbstractReader
MySqlSchema.| Modifier and Type | Class and Description |
|---|---|
protected class |
BinlogReader.ReaderThreadLifecycleListener |
| Modifier and Type | Field and Description |
|---|---|
private com.github.shyiko.mysql.binlog.BinaryLogClient |
client |
private EnumMap<com.github.shyiko.mysql.binlog.event.EventType,BlockingConsumer<com.github.shyiko.mysql.binlog.event.Event>> |
eventHandlers |
private RecordMakers |
recordMakers |
private boolean |
recordSchemaChangesInSourceRecords |
private SourceInfo |
source |
private int |
startingRowNumber |
context, logger| Constructor and Description |
|---|
BinlogReader(MySqlTaskContext context)
Create a binlog reader.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
doCleanup()
The reader has completed sending all
enqueued records, so clean up any resources
that remain. |
protected void |
doStart()
The reader has been requested to start, so initialize any resources required by the reader.
|
protected void |
doStop()
The reader has been requested to stop, so perform any work required to stop the reader's resources that were previously
started.. |
protected void |
handleDelete(com.github.shyiko.mysql.binlog.event.Event event)
Generate source records for the supplied event with an
DeleteRowsEventData. |
protected void |
handleEvent(com.github.shyiko.mysql.binlog.event.Event event) |
protected void |
handleGtidEvent(com.github.shyiko.mysql.binlog.event.Event event)
Handle the supplied event with a
GtidEventData that signals the beginning of a GTID transaction. |
protected void |
handleInsert(com.github.shyiko.mysql.binlog.event.Event event)
Generate source records for the supplied event with an
WriteRowsEventData. |
protected void |
handleQueryEvent(com.github.shyiko.mysql.binlog.event.Event event)
Handle the supplied event with an
QueryEventData by possibly recording the DDL statements as changes in the
MySQL schemas. |
protected void |
handleRotateLogsEvent(com.github.shyiko.mysql.binlog.event.Event event)
Handle the supplied event with a
RotateEventData that signals the logs are being rotated. |
protected void |
handleServerHeartbeat(com.github.shyiko.mysql.binlog.event.Event event)
Handle the supplied event that is sent by a master to a slave to let the slave know that the master is still alive.
|
protected void |
handleServerIncident(com.github.shyiko.mysql.binlog.event.Event event)
Handle the supplied event that signals that an out of the ordinary event that occurred on the master.
|
protected void |
handleServerStop(com.github.shyiko.mysql.binlog.event.Event event)
Handle the supplied event that signals that mysqld has stopped.
|
protected void |
handleUpdate(com.github.shyiko.mysql.binlog.event.Event event)
Generate source records for the supplied event with an
UpdateRowsEventData. |
protected void |
handleUpdateTableMetadata(com.github.shyiko.mysql.binlog.event.Event event)
Handle a change in the table metadata.
|
protected void |
ignoreEvent(com.github.shyiko.mysql.binlog.event.Event event) |
protected void |
logEvent(com.github.shyiko.mysql.binlog.event.Event event) |
protected com.github.shyiko.mysql.binlog.network.SSLMode |
sslModeFor(MySqlConnectorConfig.SecureConnectionMode mode) |
protected <T extends com.github.shyiko.mysql.binlog.event.EventData> |
unwrapData(com.github.shyiko.mysql.binlog.event.Event event) |
completeSuccessfully, enqueueRecord, failed, failed, isRunning, poll, start, stop, wrapprivate final boolean recordSchemaChangesInSourceRecords
private final RecordMakers recordMakers
private final SourceInfo source
private final EnumMap<com.github.shyiko.mysql.binlog.event.EventType,BlockingConsumer<com.github.shyiko.mysql.binlog.event.Event>> eventHandlers
private com.github.shyiko.mysql.binlog.BinaryLogClient client
private int startingRowNumber
public BinlogReader(MySqlTaskContext context)
context - the task context in which this reader is running; may not be nullprotected void doStart()
AbstractReaderdoStart in class AbstractReaderprotected void doStop()
AbstractReaderstarted..doStop in class AbstractReaderprotected void doCleanup()
AbstractReaderenqueued records, so clean up any resources
that remain.doCleanup in class AbstractReaderprotected void logEvent(com.github.shyiko.mysql.binlog.event.Event event)
protected void ignoreEvent(com.github.shyiko.mysql.binlog.event.Event event)
protected void handleEvent(com.github.shyiko.mysql.binlog.event.Event event)
protected <T extends com.github.shyiko.mysql.binlog.event.EventData> T unwrapData(com.github.shyiko.mysql.binlog.event.Event event)
protected void handleServerStop(com.github.shyiko.mysql.binlog.event.Event event)
event - the server stopped event to be processed; may not be nullprotected void handleServerHeartbeat(com.github.shyiko.mysql.binlog.event.Event event)
event - the server stopped event to be processed; may not be nullprotected void handleServerIncident(com.github.shyiko.mysql.binlog.event.Event event)
event - the server stopped event to be processed; may not be nullprotected void handleRotateLogsEvent(com.github.shyiko.mysql.binlog.event.Event event)
RotateEventData that signals the logs are being rotated. This means that either
the server was restarted, or the binlog has transitioned to a new file. In either case, subsequent table numbers will be
different than those seen to this point, so we need to discard the cache of record makers.event - the database change data event to be processed; may not be nullprotected void handleGtidEvent(com.github.shyiko.mysql.binlog.event.Event event)
GtidEventData that signals the beginning of a GTID transaction.event - the GTID event to be processed; may not be nullprotected void handleQueryEvent(com.github.shyiko.mysql.binlog.event.Event event)
QueryEventData by possibly recording the DDL statements as changes in the
MySQL schemas.event - the database change data event to be processed; may not be nullprotected void handleUpdateTableMetadata(com.github.shyiko.mysql.binlog.event.Event event)
This method should be called whenever we consume a TABLE_MAP event, and every transaction in the log should include one of these for each table affected by the transaction. Each table map event includes a monotonically-increasing numeric identifier, and this identifier is used within subsequent events within the same transaction. This table identifier can change when:
ALTER TABLE ... command); orevent - the update event; never nullprotected void handleInsert(com.github.shyiko.mysql.binlog.event.Event event)
throws InterruptedException
WriteRowsEventData.event - the database change data event to be processed; may not be nullInterruptedException - if this thread is interrupted while blockingprotected void handleUpdate(com.github.shyiko.mysql.binlog.event.Event event)
throws InterruptedException
UpdateRowsEventData.event - the database change data event to be processed; may not be nullInterruptedException - if this thread is interrupted while blockingprotected void handleDelete(com.github.shyiko.mysql.binlog.event.Event event)
throws InterruptedException
DeleteRowsEventData.event - the database change data event to be processed; may not be nullInterruptedException - if this thread is interrupted while blockingprotected com.github.shyiko.mysql.binlog.network.SSLMode sslModeFor(MySqlConnectorConfig.SecureConnectionMode mode)
Copyright © 2016 JBoss by Red Hat. All rights reserved.