shyiko / mysql-binlog-connector-java

MySQL Binary Log connector

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BinaryLogClient auto detects wrongly MariaDB instead of MySQL

bdeneuter opened this issue · comments

Hi,

With version 0.27.1, the BinaryLogClient tries to detect if the GtidSet is a MariaDB GtidSet or not. It uses the pattern ^\d+-\d+-\d+ to detect this.
We are using MySQL 8.0 and have a GtidSet that matches this pattern. So the client thinks it is a MariaDb GtidSet and crashes when it connects because it is not MariaDb but MySQL 8.0.
Our MySQL GtidSet is the following:
07212070-4330-3bc8-8a3a-01e34be47bc3:1-141692942,a0c4a949-fae8-30f3-a4d2-fee56a1a9307:1-1427643460,a16ef643-1d4a-3fd9-a86e-1adeb836eb2d:1-1411988930,b0d822f4-5a84-30d3-a929-61f64740d7ac:1-59364

As we know that we are connecting to MySQL, can we avoid auto detection and specify to the BinaryLogClient that it needs to use MySQL and not MariaDB? I don't see the need for auto detection as the user from the library knows to which database he/she connects.

The exception we see in the logs:

java.lang.NumberFormatException: For input string: "3bc8"
at java.base/java.lang.NumberFormatException.forInputString(Unknown Source)
at java.base/java.lang.Long.parseLong(Unknown Source)
at java.base/java.lang.Long.parseLong(Unknown Source)
at com.github.shyiko.mysql.binlog.MariadbGtidSet$MariaGtid.(MariadbGtidSet.java:185)
at com.github.shyiko.mysql.binlog.MariadbGtidSet$MariaGtid.parse(MariadbGtidSet.java:189)
at com.github.shyiko.mysql.binlog.MariadbGtidSet.(MariadbGtidSet.java:39)
at com.github.shyiko.mysql.binlog.BinaryLogClient.setGtidSet(BinaryLogClient.java:355)
at