use of com.github.shyiko.mysql.binlog.event.GtidEventData in project debezium by debezium.
the class BinlogReader method handleGtidEvent.
/**
* Handle the supplied event with a {@link GtidEventData} that 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.
* <p>
* Note that this captures the current GTID and complete GTID set, regardless of whether the connector is
* {@link MySqlTaskContext#gtidSourceFilter() filtering} the 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.
*
* @param event the GTID event to be processed; may not be null
*/
protected void handleGtidEvent(Event event) {
logger.debug("GTID transaction: {}", event);
GtidEventData gtidEvent = unwrapData(event);
String gtid = gtidEvent.getGtid();
gtidSet.add(gtid);
// rather than use the client's GTID set
source.startGtid(gtid, gtidSet.toString());
ignoreDmlEventByGtidSource = false;
if (gtidDmlSourceFilter != null && gtid != null) {
String uuid = gtid.trim().substring(0, gtid.indexOf(":"));
if (!gtidDmlSourceFilter.test(uuid)) {
ignoreDmlEventByGtidSource = true;
}
}
}
Aggregations