Hongshun Wang created FLINK-35349:
-------------------------------------

             Summary: Use connection in openJdbcConnection of 
SqlServerDialect/Db2Dialect/OracleDialect
                 Key: FLINK-35349
                 URL: https://issues.apache.org/jira/browse/FLINK-35349
             Project: Flink
          Issue Type: Improvement
          Components: Flink CDC
    Affects Versions: cdc-3.1.0
            Reporter: Hongshun Wang
             Fix For: cdc-3.2.0


Current, some dialect's `openJdbcConnection`  create connection without 
connection pool. It means that will create a new connection each time.

Howver , openJdbcConnection is used in generateSplits now, which means that 
enumerator will create a new connection for once split. A big table will create 
connection again and again.
{code:java}
public Collection<SnapshotSplit> generateSplits(TableId tableId) {
    try (JdbcConnection jdbc = dialect.openJdbcConnection(sourceConfig)) {

        LOG.info("Start splitting table {} into chunks...", tableId);
        long start = System.currentTimeMillis();

        Table table =
                Objects.requireNonNull(dialect.queryTableSchema(jdbc, 
tableId)).getTable();
        Column splitColumn = getSplitColumn(table, 
sourceConfig.getChunkKeyColumn());
        final List<ChunkRange> chunks; {code}



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

Reply via email to