nickdelnano opened a new pull request, #8323:
URL: https://github.com/apache/paimon/pull/8323

   ## Summary
   
   - Introduces `CachedJdbcClientPool`, a static Caffeine-cached pool that 
shares `JdbcClientPool` instances across all `JdbcCatalog` instances in the 
same JVM, keyed by `(JDBC URI, catalog-key)`.
   - Mirrors the existing pattern used by Hive's `CachedClientPool` for HMS 
Thrift connections.
   - Reduces JDBC connections from `O(parallelism × operators × pool_size)` to 
`O(TaskManagers × pool_size)` in Flink CDC jobs.
   
   ## Motivation
   
   In Flink CDC database sync jobs (combined mode), every operator subtask that 
calls `catalogLoader.load()` creates a new `JdbcCatalog` with its own dedicated 
connection pool (default size: 2). With parallelism 16, a single job creates 
~128 JDBC connections across parser, schema evolution, writer, and committer 
operators. The HiveCatalog avoids this via `CachedClientPool` — a static 
Caffeine cache that shares a single HMS client pool across all catalog 
instances in the same JVM.
   
   This PR applies the same pattern to `JdbcCatalog`.
   
   ## Changes
   
   - **`CachedJdbcClientPool`** (new): Static `Cache<Key, JdbcClientPool>` 
keyed on `(URI, catalog-key)`. Idle pools evicted after configurable interval 
(default 5 min).
   - **`JdbcCatalog`**: Uses `CachedJdbcClientPool.get()` instead of creating a 
dedicated pool. `close()` no longer closes the shared pool.
   - **`JdbcCatalogLockContext`**: Same — uses the shared cached pool.
   - **`JdbcCatalogOptions`**: New `client-pool-cache.eviction-interval-ms` 
option.
   
   ## Test plan
   
   - [x] `JdbcCatalogTest` (70 tests) — passes
   - [x] `JdbcClientPoolTest` (4 tests) — passes


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to