You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "Lif0820 (via GitHub)" <gi...@apache.org> on 2025/12/15 07:14:10 UTC
[I] [Bug] Doris 2.1.11版本,jdbc客户端设置useCursorFetch=true时,stmt.getMetaData()返回null [doris]
Lif0820 opened a new issue, #59037:
URL: https://github.com/apache/doris/issues/59037
### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no similar issues.
### Version
2.1.11
### What's Wrong?
我们一直使用embulk-input-mysql组件抽取doris数据到hdfs,近期将doris从2.0.7升级到2.1.11后,此功能全部出错。报错显示PreparedStatement.getMetaData()返回null。
经过调试源码,发现可能与数据库useCursorFetch、useServerPrepStmts行为有关,以下Java代码可以复现该问题:
```java
public class Aaa {
public static void main(String[] args) throws Exception {
Properties props = new Properties();
props.put("characterEncoding", "UTF-8");
props.put("useServerPrepStmts", "false");
props.put("useCursorFetch", "true"); // 关键点
props.put("useSSL", "false");
props.put("useUnicode", "true");
props.put("serverTimezone", "Asia/Shanghai");
props.put("user", "bdp");
props.put("password", "bdp");
Connection con1 = DriverManager.getConnection("jdbc:mysql://10.66.224.223:9030/clw", props);
Connection con2 = DriverManager.getConnection("jdbc:mysql://10.66.110.166:19030/clw", props);
Connection con3 = DriverManager.getConnection("jdbc:mysql://10.66.110.16:9030/db_es", props);
System.out.println(con1.prepareStatement("select 1").getMetaData() == null); // doris-2.1.11 true
System.out.println(con2.prepareStatement("select 1").getMetaData() == null); // doris-2.0.7 false
System.out.println(con3.prepareStatement("select 1").getMetaData() == null); // doris-4.0.1 false
}
}
```
### What You Expected?
定位错误并解决
### How to Reproduce?
_No response_
### Anything Else?
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [I] [Bug] Doris 2.1.11版本,jdbc客户端设置useCursorFetch=true时,stmt.getMetaData()返回null [doris]
Posted by "Lif0820 (via GitHub)" <gi...@apache.org>.
Lif0820 closed issue #59037: [Bug] Doris 2.1.11版本,jdbc客户端设置useCursorFetch=true时,stmt.getMetaData()返回null
URL: https://github.com/apache/doris/issues/59037
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [I] [Bug] Doris 2.1.11版本,jdbc客户端设置useCursorFetch=true时,stmt.getMetaData()返回null [doris]
Posted by "Lif0820 (via GitHub)" <gi...@apache.org>.
Lif0820 commented on issue #59037:
URL: https://github.com/apache/doris/issues/59037#issuecomment-3680103708
> 我这边找到了问题的部分,是2.0.7和2.1.11的fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java的问题,但我不会调试这个, 是2.1.11在处理元数据的时候,涉及到预处理语句都会直接跳过元数据构建,这个时候用useCursorFetch=true就会让客户端一直检查元数据,好像挺严格的,就会导致报错,而4.0.1版本对这个部分又进行了重构,应该也不会导致这个问题
谢谢关注!我看到了你的fix,下载了doris-fe-2.1.11-rc01源码,以及你的补丁,编译后进行本地验证,发现这个fix可能未能修复此问题。
现象是代码实际走的if else分支是:List<String> colLabels = ((LogicalPlanAdapter) parsedStmt).getColLabels(),且依旧返回null,并不是SelectStmt。
我依次尝试了2.x很多版本,想知道为何2.0.7可以返回metadata,后来发现2.0.7及部分2.1早期版本,是代码层抛出不支持ServerPreparedStatement的异常,转为使用JDBC42PreparedStatement。
目前我暂时通过useCursorFetch=false、useServerPrepStmts=false组合来屏蔽该问题。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [I] [Bug] Doris 2.1.11版本,jdbc客户端设置useCursorFetch=true时,stmt.getMetaData()返回null [doris]
Posted by "LSeaPDynasty (via GitHub)" <gi...@apache.org>.
LSeaPDynasty commented on issue #59037:
URL: https://github.com/apache/doris/issues/59037#issuecomment-3660063850
我这边找到了问题的部分,是2.0.7和2.1.11的fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java的问题,但我不会调试这个,
是2.1.11在处理元数据的时候,涉及到预处理语句都会直接跳过元数据构建,这个时候用useCursorFetch=true就会让客户端一直检查元数据,好像挺严格的,就会导致报错,而4.0.1版本对这个部分又进行了重构,应该也不会导致这个问题
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org