maxwell无法获取server_id【obproxy bug】

【 使用环境 】测试环境
【 OB or 其他组件 】 OB-ce 4.3.3.1, OBProxy-ce 4.3.2.0-26, obbinlog-ce 4.0.1

反馈一个obproxy的bug

在配置好obbinlog后,maxwell启动报错,提示找不到server_id列。

2024-11-21 15:28:40 ERROR Maxwell - SQLException: Column 'server_id' not found.
java.sql.SQLException: Column 'server_id' not found.
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) ~[mysql-connector-java-8.0.28.jar:8.0.28]
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[mysql-connector-java-8.0.28.jar:8.0.28]
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) ~[mysql-connector-java-8.0.28.jar:8.0.28]
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) ~[mysql-connector-java-8.0.28.jar:8.0.28]
        at com.mysql.cj.jdbc.result.ResultSetImpl.findColumn(ResultSetImpl.java:584) ~[mysql-connector-java-8.0.28.jar:8.0.28]
        at com.mysql.cj.jdbc.result.ResultSetImpl.getLong(ResultSetImpl.java:862) ~[mysql-connector-java-8.0.28.jar:8.0.28]
        at com.mchange.v2.c3p0.impl.NewProxyResultSet.getLong(NewProxyResultSet.java:477) ~[c3p0-0.9.5.5.jar:0.9.5.5]
        at com.zendesk.maxwell.MaxwellContext.getServerID(MaxwellContext.java:473) ~[maxwell-1.41.2.jar:1.41.2]
        at com.zendesk.maxwell.MaxwellContext.<init>(MaxwellContext.java:133) ~[maxwell-1.41.2.jar:1.41.2]
        at com.zendesk.maxwell.Maxwell.<init>(Maxwell.java:44) ~[maxwell-1.41.2.jar:1.41.2]
        at com.zendesk.maxwell.Maxwell.main(Maxwell.java:322) [maxwell-1.41.2.jar:1.41.2]

【问题分析】
看了maxwell的源码,maxwell在启动时会执行SQL获取server_id。

SELECT @@server_id as server_id

这个SQL返回的列名与MySQL不一致,与obproxy不开启binlog时也不一致。

开启了binlog的obproxy返回:
image

未开启binlog的obproxy返回:
image

mysql返回:
image

多测了两下,server_id这bug还挺多的。自己看吧……

这个是 logproxy 的返回结果,

可以直连 logproxy 确认查询结果