zendesk / maxwell

Maxwell's daemon, a mysql-to-json kafka producer
https://maxwells-daemon.io/
Other
4.05k stars 1.01k forks source link

mysql8.0X not support "SHOW BINARY LOG STATUS" #2123

Open I-Like-Pepsi opened 4 weeks ago

I-Like-Pepsi commented 4 weeks ago

image 错误信息如下: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LOG STATUS' at line 1 I encountered a minor issue while using Maxwell. mysql-version:8.0.40 I found the following code after reviewing the source code

    public String getShowBinlogSQL() {
        try {
            DatabaseMetaData md = connection.getMetaData();
            if ( md.getDatabaseMajorVersion() >= 8 ) {
                return "SHOW BINARY LOG STATUS";
            }
        } catch ( SQLException e ) {
        }

        return "SHOW MASTER STATUS";
    }

I think the code should be changed to the following

    public String getShowBinlogSQL() {
        try {
            DatabaseMetaData md = connection.getMetaData();
            if ( md.getDatabaseMajorVersion() >= 8 && md.getDatabaseMinorVersion() >= 4) {
                return "SHOW BINARY LOG STATUS";
            }
        } catch ( SQLException e ) {
        }

        return "SHOW MASTER STATUS";
    }

https://dev.mysql.com/doc/refman/8.4/en/show-binary-log-status.html https://dev.mysql.com/doc/refman/8.0/en/show-master-status.html

Tang-RoseChild commented 2 weeks ago

@osheroff hi, please take a look at it, if should fix it, then release a new version ? current v1.41.2 doesn't support mysql 8.4.xx

Thanks a lot