mailtoboggavarapu-coder opened a new pull request, #19772: URL: https://github.com/apache/hudi/pull/19772
### Describe the issue this Pull Request addresses `UtilHelpers.getJDBCSchema()` opens a JDBC `Connection` via `createConnection()` but never closes it. The connection leaks on every code path: - Normal return after fetching the schema - Early exit when the table does not exist - Any exception thrown during schema query execution For Spark jobs that call this method repeatedly (e.g., during JDBC-based schema inference at startup or on schema evolution), leaked connections accumulate and eventually exhaust the external database's connection pool. ### Summary and Changelog Wrapped the `Connection` in a try-with-resources statement so it is always closed after use, regardless of whether the schema fetch succeeds or throws. The nested `PreparedStatement` and `ResultSet` were already managed with try-with-resources; this change brings the outer `Connection` in line with the same pattern and simplifies the control flow by merging the previously separate try/catch blocks. - `UtilHelpers.java`: Replaced manual `Connection` variable with try-with-resources; merged two sequential try/catch blocks into one. ### Impact No behaviour change on the success path. Prevents JDBC connection leaks in any pipeline that uses `getJDBCSchema()` (e.g., JDBC-sourced schema inference in HoodieStreamer). ### Risk Level low — Resource-management change only; no modification to query logic, schema parsing, or error messages. ### Documentation Update none ### Contributor's checklist - [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute) - [ ] Enough context is provided in the sections above - [ ] 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]
