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

   ### What changes were proposed in this pull request?
   
   Wrap each resource close in `BaseCatalog.close()` in its own try/catch so 
that a failure in `ops.close()` does not prevent `authorizationPlugin` and 
`catalogCredentialManager` from being closed. The first caught exception is 
rethrown, with subsequent exceptions added as suppressed.
   
   ### Why are the changes needed?
   
   `BaseCatalog.close()` closes `ops`, `authorizationPlugin`, and 
`catalogCredentialManager` sequentially. If `ops.close()` throws, the remaining 
resources are never closed, causing resource leaks during catalog shutdown.
   
   Fix: #10604
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. The only behavioral change is that all three resources are now always 
closed, even if an earlier close fails.
   
   ### How was this patch tested?
   
   Added a unit test (`testCloseClosesAllResourcesWhenOpsCloseFails`) in 
`TestBaseCatalog` that:
   1. Mocks `ops.close()` to throw `IOException`
   2. Verifies `authorizationPlugin.close()` and `credentialManager.close()` 
are still called
   3. Asserts the `IOException` is rethrown
   
   All tests in `TestBaseCatalog` pass. Formatted with `spotlessApply`.


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