osheroff / mysql-binlog-connector-java

MySQL Binary Log connector
641 stars 161 forks source link

A commitGtid() after a MARIADB_GTID_LIST event only adds one gtid of the list to the GtidSet #100

Open janickr opened 1 year ago

janickr commented 1 year ago

I am not familiar with the MariaDB replication protocol, but while reading the code I noticed that:

1) when a MARIADB_GTID_LIST event occurs, the event data is parsed into a GtidSet 2) the BinaryLogClient keeps mariadbGtidListEventData.getMariaGTIDSet().toString() in its gtid field, this is a comma separated string of all position map values (could be random order because of hashmap) 3) when an event occurs that triggers a commitGtid, the String in gtid is passed to the MariadbGtidSet.add method 4) the add method calls MariaGtid.parse, which splits on '-', and takes the first 3 items as domainId, serverId and sequence. But the string could contain more gtids which are discarded in this case. 5) the single MariaGtid is added to the GtidSet

Instead, shouldn't all gtids from the MARIADB_GTID_LIST event be added to the GtidSet?