DBZ-1482 Don't initiate a transaction for every MariaDB GTID event.
There are use cases where MariaDB will send a GTID event to start a transaction but that event will not conclude with a COMMIT and in those cases, don't start a buffer transaction boundary.
This commit is contained in:
parent
25a68ba3ef
commit
e722845717
@ -13,6 +13,7 @@
|
||||
|
||||
import com.github.shyiko.mysql.binlog.event.Event;
|
||||
import com.github.shyiko.mysql.binlog.event.EventType;
|
||||
import com.github.shyiko.mysql.binlog.event.MariadbGtidEventData;
|
||||
import com.github.shyiko.mysql.binlog.event.QueryEventData;
|
||||
|
||||
import io.debezium.connector.mysql.MySqlStreamingChangeEventSource.BinlogPosition;
|
||||
@ -107,8 +108,14 @@ else if (sql.equalsIgnoreCase("ROLLBACK")) {
|
||||
}
|
||||
}
|
||||
else if (event.getHeader().getEventType() == EventType.MARIADB_GTID) {
|
||||
// signals a new transaction for MariaDB, treat like QUERY events with BEGIN
|
||||
beginTransaction(partition, offsetContext, event);
|
||||
// When the GTID_EVENT has flag 1 set (meaning there is no following commit),
|
||||
// then we don't create a new transaction for this. This typically happens
|
||||
// for DDL operations which are always transaction scoped.
|
||||
MariadbGtidEventData gtidEventData = (MariadbGtidEventData) event.getData();
|
||||
if ((gtidEventData.getFlags() & 0x01) != 0x01) {
|
||||
// signals a new transaction for MariaDB, treat like QUERY events with BEGIN
|
||||
beginTransaction(partition, offsetContext, event);
|
||||
}
|
||||
}
|
||||
else if (event.getHeader().getEventType() == EventType.XID) {
|
||||
completeTransaction(partition, offsetContext, true, event);
|
||||
|
Loading…
Reference in New Issue
Block a user