fhan688 opened a new pull request, #20303:
URL: https://github.com/apache/hudi/pull/20303

   ### Describe the issue this Pull Request addresses
   
     The Kafka Connect transaction coordinator fetches the latest topic 
partition count whenever it starts a new commit. 
`KafkaConnectUtils#getLatestNumPartitions` creates an `AdminClient` for each 
lookup but does not close it.
   
     For long-running connectors, repeated commit cycles can therefore 
accumulate Kafka AdminClient threads, network connections, and other resources. 
The client is leaked on both successful lookups and exceptional paths.
   
   ### Summary and Changelog
   
     - Manage the temporary `AdminClient` with try-with-resources.
     - Ensure the client is closed after both successful and failed topic 
metadata lookups.
     - Preserve the existing partition lookup behavior and exception handling.
     - Add unit tests verifying that the AdminClient is closed on both success 
and failure paths.
   
     No code was copied.
   
   ### Impact
   
     There are no public API, configuration, or storage format changes.
   
     Kafka Connect coordinators now release the temporary AdminClient after 
each topic partition lookup, preventing resource accumulation during repeated 
commit cycles.
   
   ### Risk Level
   
     Low.
   
     The change is localized to AdminClient resource management and does not 
alter the partition lookup result or transaction coordination behavior. Unit 
tests cover both successful and exceptional lookup paths.
   
     Tested with:
   
     `mvn -pl hudi-kafka-connect -DskipITs -Dcheckstyle.skip=true 
-DfailIfNoTests=false -Dtest=TestKafkaConnectUtils test`
   
   ### Documentation Update
   
     None.
   
   ### 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]

Reply via email to