[
https://issues.apache.org/jira/browse/FLINK-9794?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16543963#comment-16543963
]
ASF GitHub Bot commented on FLINK-9794:
---------------------------------------
Github user hequn8128 commented on the issue:
https://github.com/apache/flink/pull/6301
@jrthe42 Hi, thanks for your PR.
From my side, I think use a connection pool to solve the connection problem
is a better way. We don't need to keep the connections all the way. It wastes
the connection resources if most threads have been idle for a long time. Also,
the connection pool will not bring extra cost if threads are busy writing data
into database, since the connections in the pool will be reused.
I googled just now and find the `MiniConnectionPoolManager ` descriptions
[here](http://www.source-code.biz/miniconnectionpoolmanager/). Maybe we can
use it.
Best, Hequn
> JDBCOutputFormat does not consider idle connection and multithreads
> synchronization
> -----------------------------------------------------------------------------------
>
> Key: FLINK-9794
> URL: https://issues.apache.org/jira/browse/FLINK-9794
> Project: Flink
> Issue Type: Bug
> Components: Streaming Connectors
> Affects Versions: 1.4.0, 1.5.0
> Reporter: wangsan
> Assignee: wangsan
> Priority: Major
> Labels: pull-request-available
>
> Current implementation of JDBCOutputFormat has two potential problems:
> 1. The Connection was established when JDBCOutputFormat is opened, and will
> be used all the time. But if this connection lies idle for a long time, the
> database will force close the connection, thus errors may occur.
> 2. The flush() method is called when batchCount exceeds the threshold, but it
> is also called while snapshotting state. So two threads may modify upload and
> batchCount, but without synchronization.
> We need fix these two problems to make JDBCOutputFormat more reliable.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)