skywalker0618 opened a new pull request, #19331: URL: https://github.com/apache/hudi/pull/19331
### Describe the issue this Pull Request addresses HoodieHiveSyncClient.close() leaks one Hive Metastore connection per sync cycle. When RetryingMetaStoreClient rebuilds the underlying IMetaStoreClient after a transient TException, the fresh client is reachable only via the proxy on the client field, while the thread-local Hive singleton still points at the older instance. close() only called Hive.closeCurrent(), which closes the stale client and orphans the live one, so long-running jobs that sync every commit (Flink streaming, DeltaStreamer continuous mode) grow HMS connections until exhaustion. Fixes: #19321 ### Summary and Changelog Metastore connections are now released reliably on close(), so HMS open-connection count stays bounded across sync cycles instead of climbing over time. Changes: - HoodieHiveSyncClient.close(): close the proxied IMetaStoreClient directly (client.close()) before falling back to Hive.closeCurrent(). This closes whichever underlying client is currently live including one rebuilt by RetryingMetaStoreClient, while Hive.closeCurrent() remains as belt-and-suspenders for the singleton path. The direct close is wrapped in its own try/catch so a transient close failure doesn't skip the fallback. - Added TestHoodieHiveSyncClientClose with two unit tests: one asserting close() releases the proxied client and the DDL executor, and one asserting a failure from client.close() is swallowed rather than propagated. ### Impact Fixed the HMS connection leak issue ### Risk Level Low. We've verified it fixed the connection leak issue in Uber internal testings ### Documentation Update N/A ### Contributor's checklist - [X] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute) - [X] Enough context is provided in the sections above - [X] Adequate tests were added if applicable -- 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]
