public final class MySqlTaskContext extends CdcSourceTaskContext
MySqlConnector| Modifier and Type | Field and Description |
|---|---|
private Configuration |
config |
private MySqlJdbcContext |
connectionContext |
private MySqlConnectorConfig |
connectorConfig |
private MySqlSchema |
dbSchema |
private Predicate<String> |
ddlFilter |
private Predicate<String> |
gtidSourceFilter |
private static org.slf4j.Logger |
LOGGER |
private RecordMakers |
recordProcessor |
private SourceInfo |
source |
private boolean |
tableIdCaseInsensitive
Whether table ids are compared ignoring letter casing.
|
private TopicSelector<TableId> |
topicSelector |
| Constructor and Description |
|---|
MySqlTaskContext(Configuration config,
Filters filters) |
MySqlTaskContext(Configuration config,
Filters filters,
Boolean tableIdCaseInsensitive,
Map<String,?> restartOffset) |
MySqlTaskContext(Configuration config,
Filters filters,
Map<String,?> restartOffset) |
| Modifier and Type | Method and Description |
|---|---|
int |
bufferSizeForBinlogReader() |
Configuration |
config() |
String |
connectorName() |
MySqlSchema |
dbSchema() |
Predicate<String> |
ddlFilter()
Get the predicate function that will return
true if a DDL has to be skipped over and left out of the schema history
or false when it should be processed. |
GtidSet |
filterGtidSet(GtidSet availableServerGtidSet,
GtidSet purgedServerGtid)
Apply the include/exclude GTID source filters to the current
GTID set and merge them onto the
currently available GTID set from a MySQL server. |
MySqlJdbcContext |
getConnectionContext() |
MySqlConnectorConfig |
getConnectorConfig() |
Predicate<String> |
gtidSourceFilter()
Get the predicate function that will return
true if a GTID source is to be included, or false if
a GTID source is to be excluded. |
boolean |
historyExists()
Return true if the database history entity exists
|
boolean |
includeSchemaChangeRecords() |
boolean |
includeSqlQuery() |
void |
initializeHistory()
Initialize the database history with any server-specific information.
|
void |
initializeHistoryStorage()
Initialize permanent storage for database history
|
boolean |
isInitialSnapshotOnly() |
boolean |
isSchemaOnlyRecoverySnapshot() |
boolean |
isSchemaOnlySnapshot() |
boolean |
isSnapshotAllowedWhenNeeded() |
boolean |
isSnapshotNeverAllowed() |
boolean |
isTableIdCaseInsensitive() |
void |
loadHistory(SourceInfo startingPoint)
Load the database schema information using the previously-recorded history, and stop reading the history when the
the history reaches the supplied starting point.
|
RecordMakers |
makeRecord() |
long |
rowCountForLargeTable() |
long |
serverId() |
void |
shutdown() |
protected MySqlConnectorConfig.SnapshotMode |
snapshotMode() |
SourceInfo |
source() |
void |
start() |
void |
temporaryLoggingContext(String contextName,
Runnable operation)
Run the supplied function in the temporary connector MDC context, and when complete always return the MDC context to its
state before this method was called.
|
TopicSelector<TableId> |
topicSelector() |
capturedDataCollections, configureLoggingContext, getClock, getConnectorName, getConnectorTypeprivate static final org.slf4j.Logger LOGGER
private final MySqlJdbcContext connectionContext
private final Configuration config
private final MySqlConnectorConfig connectorConfig
private final SourceInfo source
private final MySqlSchema dbSchema
private final TopicSelector<TableId> topicSelector
private final RecordMakers recordProcessor
private final boolean tableIdCaseInsensitive
public MySqlTaskContext(Configuration config, Filters filters)
public MySqlTaskContext(Configuration config, Filters filters, Map<String,?> restartOffset)
public MySqlTaskContext(Configuration config, Filters filters, Boolean tableIdCaseInsensitive, Map<String,?> restartOffset)
public Configuration config()
public MySqlConnectorConfig getConnectorConfig()
public MySqlJdbcContext getConnectionContext()
public String connectorName()
public TopicSelector<TableId> topicSelector()
public SourceInfo source()
public MySqlSchema dbSchema()
public RecordMakers makeRecord()
public Predicate<String> gtidSourceFilter()
true if a GTID source is to be included, or false if
a GTID source is to be excluded.public void initializeHistory()
public void loadHistory(SourceInfo startingPoint)
startingPoint - the source information with the current SourceInfo.partition() and offset at which the database schemas are to reflect; may not be nullpublic boolean historyExists()
public void initializeHistoryStorage()
public long serverId()
public long rowCountForLargeTable()
public int bufferSizeForBinlogReader()
public boolean includeSchemaChangeRecords()
public boolean includeSqlQuery()
public boolean isSnapshotAllowedWhenNeeded()
public boolean isSnapshotNeverAllowed()
public boolean isInitialSnapshotOnly()
public boolean isSchemaOnlySnapshot()
public boolean isSchemaOnlyRecoverySnapshot()
protected MySqlConnectorConfig.SnapshotMode snapshotMode()
public void start()
public void shutdown()
public void temporaryLoggingContext(String contextName, Runnable operation)
contextName - the name of the context; may not be nulloperation - the function to run in the new MDC context; may not be nullIllegalArgumentException - if any of the parameters are nullpublic GtidSet filterGtidSet(GtidSet availableServerGtidSet, GtidSet purgedServerGtid)
GTID set and merge them onto the
currently available GTID set from a MySQL server.
The merging behavior of this method might seem a bit strange at first. It's required in order for Debezium to consume a
MySQL binlog that has multi-source replication enabled, if a failover has to occur. In such a case, the server that
Debezium is failed over to might have a different set of sources, but still include the sources required for Debezium
to continue to function. MySQL does not allow downstream replicas to connect if the GTID set does not contain GTIDs for
all channels that the server is replicating from, even if the server does have the data needed by the client. To get
around this, we can have Debezium merge its GTID set with whatever is on the server, so that MySQL will allow it to
connect. See DBZ-143 for details.
This method does not mutate any state in the context.availableServerGtidSet - the GTID set currently available in the MySQL serverpurgedServerGtid - the GTID set already purged by the MySQL serverpublic Predicate<String> ddlFilter()
true if a DDL has to be skipped over and left out of the schema history
or false when it should be processed.public boolean isTableIdCaseInsensitive()
Copyright © 2019 JBoss by Red Hat. All rights reserved.