【 使用环境 】测试环境
【 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返回:
未开启binlog的obproxy返回:
mysql返回: