mysql-binlog-connector-java icon indicating copy to clipboard operation
mysql-binlog-connector-java copied to clipboard

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

Open janickr opened this issue 2 years ago • 0 comments

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?

janickr avatar Feb 09 '23 20:02 janickr