-
Notifications
You must be signed in to change notification settings - Fork 714
[#9581] fix(hive): Perform resource cleanup in HiveClientPool close #9617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
CC @diqiu50 |
catalogs/hive-metastore-common/src/main/java/org/apache/gravitino/hive/HiveClientPool.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a resource leak issue in HiveClientPool where the close() method was a no-op, preventing proper cleanup of Hive Metastore client connections. The fix ensures that when the pool is closed, the underlying client resources are properly released by calling client.close().
Key Changes
- Added
client.close()call inHiveClientPool.close()to perform actual resource cleanup - Updated comments to clarify that reconnect is handled by
RetryingMetaStoreClientrather than the pool - Added comprehensive unit tests to verify the close behavior and prevent regression
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
catalogs/hive-metastore-common/src/main/java/org/apache/gravitino/hive/HiveClientPool.java |
Fixed the close method to call client.close() and improved comments explaining the no-op reconnect behavior |
catalogs/hive-metastore-common/src/test/java/org/apache/gravitino/hive/TestHiveClientPool.java |
Added unit tests covering client creation failures, reconnect behavior, and close verification |
catalogs/hive-metastore-common/build.gradle.kts |
Added mockito-core test dependency for mocking in unit tests |
| import org.junit.jupiter.api.AfterEach; | ||
| import org.junit.jupiter.api.BeforeEach; | ||
| import org.junit.jupiter.api.Test; | ||
| import org.mockito.Mockito; |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using static imports for Mockito methods to improve readability and align with the project's conventions. Most test files in the codebase use static imports like import static org.mockito.Mockito.mock;, import static org.mockito.Mockito.spy;, etc., instead of using Mockito. prefix throughout the test class.
catalogs/hive-metastore-common/src/main/java/org/apache/gravitino/hive/HiveClientPool.java
Outdated
Show resolved
Hide resolved
catalogs/hive-metastore-common/src/test/java/org/apache/gravitino/hive/TestHiveClientPool.java
Outdated
Show resolved
Hide resolved
catalogs/hive-metastore-common/src/test/java/org/apache/gravitino/hive/TestHiveClientPool.java
Show resolved
Hide resolved
catalogs/hive-metastore-common/src/main/java/org/apache/gravitino/hive/HiveClientPool.java
Outdated
Show resolved
Hide resolved
|
@diqiu50 Do u think that we should back port this pull request to branch 1.1? |
Yes, I think so. |
|
@diqiu50 Sure,I will follow up |
…lose (apache#9617) <!-- 1. Title: [#<issue>] <type>(<scope>): <subject> Examples: - "[apache#123] feat(operator): support xxx" - "[apache#233] fix: check null before access result in xxx" - "[MINOR] refactor: fix typo in variable name" - "[MINOR] docs: fix typo in README" - "[apache#255] test: fix flaky test NameOfTheTest" Reference: https://www.conventionalcommits.org/en/v1.0.0/ 2. If the PR is unfinished, please mark this PR as draft. --> ### What changes were proposed in this pull request? This PR performs actual resource cleanup in `HiveClientPool.close` ### Why are the changes needed? Any code path in the current implementation that close the pool via `ClientPoolImpl.close()` will cause the connection leaks because the HiveClientPool.close is a no-op. Fix: apache#9581 ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Add UTs.
What changes were proposed in this pull request?
This PR performs actual resource cleanup in
HiveClientPool.closeWhy are the changes needed?
Any code path in the current implementation that close the pool via
ClientPoolImpl.close()will cause the connection leaks because the HiveClientPool.close is a no-op.Fix: #9581
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Add UTs.