Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: 查询全局变量时没有正确处理别名,导致获取不到server_id #66

Open
lenmore opened this issue Jan 17, 2025 · 1 comment

Comments

@lenmore
Copy link

lenmore commented Jan 17, 2025

Describe the bug

oblog proxy 版本: v4.2.0

这个问题在社区反馈过(https://ask.oceanbase.com/t/topic/35615629 ),没人跟进,只能来这再反馈一次。

背景是测试Maxwell抽取oblogproxy时,报错找不到server_id列。

2025-01-17 16:22:37 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

直连 obbinlog instance实例查询

Image

基于以上可以确定是oblogproxy的bug。

我临时改了几行代码尝试修复了,供参考: lenmore@c798914

Environment

oblog proxy 版本: v4.2.0

Fast reproduce steps

SELECT @@server_id as server_id;
SELECT @@server_id as abc;

Expected behavior

No response

Actual behavior

No response

Additional context

No response

@whhe
Copy link
Member

whhe commented Jan 21, 2025

感谢反馈!之前在论坛提问的时候,支持的同学可能没搞清楚问题。我们尽快修复一下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants