You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Feng Jin (Jira)" <ji...@apache.org> on 2022/07/01 11:07:00 UTC

[jira] [Comment Edited] (FLINK-28345) Flink JDBC connector should check batch count before flush

    [ https://issues.apache.org/jira/browse/FLINK-28345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17561418#comment-17561418 ] 

Feng Jin edited comment on FLINK-28345 at 7/1/22 11:06 AM:
-----------------------------------------------------------

Whether it will increase the complexity of generic JDBC implementation is worth considering, but I don't think adding this judgment is a special implementation, or maybe a general optimization ? 

Maybe I have some aspects I didn't take into account, please correct me if I'm wrong.

In view of the fact that the community officials have not added support for the clickhouse, most users may not encounter this problem, but at least I hope this scenario can be considered in the new version of the connector.


was (Author: hackergin):
Whether it will increase the complexity of generic JDBC implementation is worth considering, but I don't think adding this judgment is a special implementation, or maybe a general optimization ?  Maybe I have some aspects I didn't take into account, please correct me if I'm wrong. In view of the fact that the community officials have not added support for the clickhouse system, most users may not encounter this problem, but at least I hope this scenario can be considered in the new version of the connector.

> Flink JDBC connector should check batch count before flush
> ----------------------------------------------------------
>
>                 Key: FLINK-28345
>                 URL: https://issues.apache.org/jira/browse/FLINK-28345
>             Project: Flink
>          Issue Type: Improvement
>          Components: Connectors / JDBC
>    Affects Versions: 1.15.0, 1.14.5
>            Reporter: Feng Jin
>            Priority: Major
>
> org.apache.flink.connector.jdbc.internal.JdbcOutputFormat#flush
> {code:java}
> //代码占位符
> @Override
> public synchronized void flush() throws IOException {
>     checkFlushException();
>     for (int i = 0; i <= executionOptions.getMaxRetries(); i++) {
>         try {
>             attemptFlush();
>             batchCount = 0;
>             break; 
>    ....{code}
> When flush the batch,  we should check batchCount  is grater than 0. Other wise it would cause some problem with some drivers that do not support empty batches, like clickhouse jdbc driver. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)