flink-cdc
flink-cdc copied to clipboard
[FLINK-35524][cdc-base] Clear connections pools when reader exist.
Current, inJdbcConnectionPools is static instance, so the datasource pools in it won't be recycle when reader close. It will cause memory leak.
public class JdbcConnectionPools implements ConnectionPools<HikariDataSource, JdbcSourceConfig> {
private static final Logger LOG = LoggerFactory.getLogger(JdbcConnectionPools.class);
private static JdbcConnectionPools instance;
private final Map<ConnectionPoolId, HikariDataSource> pools = new HashMap<>();
private static final Map<String, JdbcConnectionPoolFactory> POOL_FACTORY_MAP = new HashMap<>();
@Jiabao-Sun @GOODBOY008 @PatrickRen @leonardBang , CC