LuciferYang opened a new pull request, #13450:
URL: https://github.com/apache/gravitino/pull/13450

   ### What changes were proposed in this pull request?
   
   `JdbcPartitionStatisticStorage.close()` now closes an `AutoCloseable` 
`DataSource` (such as DBCP2's `BasicDataSource`) it owns, matching the Lance 
storage that releases its resources on close. A non-`AutoCloseable` (externally 
managed or injected) `DataSource` keeps its existing lifecycle and is left 
untouched.
   
   ### Why are the changes needed?
   
   The factory that was assumed to own the `DataSource` is a constructor-local 
in `StatisticManager` and unreachable at shutdown, so the no-op `close()` 
leaked the DBCP2 pool and its sockets on every create/close cycle.
   
   Fix: #13449
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Added `TestJdbcPartitionStatisticStorage.testCloseClosesOwnedDataSource`, 
which pins that an owned `AutoCloseable` `DataSource` is closed (and 
idempotently), while an injected non-`AutoCloseable` one is left open. It fails 
against the pre-fix code.
   


-- 
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