You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "joeyutong (via GitHub)" <gi...@apache.org> on 2026/01/05 03:04:55 UTC
[PR] [#9581] fix(hive): Perform resource cleanup in HiveClientPool close [gravitino]
joeyutong opened a new pull request, #9617:
URL: https://github.com/apache/gravitino/pull/9617
<!--
1. Title: [#<issue>] <type>(<scope>): <subject>
Examples:
- "[#123] feat(operator): support xxx"
- "[#233] fix: check null before access result in xxx"
- "[MINOR] refactor: fix typo in variable name"
- "[MINOR] docs: fix typo in README"
- "[#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: #9581
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Add UTs.
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#9581] fix(hive): Perform resource cleanup in HiveClientPool close [gravitino]
Posted by "joeyutong (via GitHub)" <gi...@apache.org>.
joeyutong commented on PR #9617:
URL: https://github.com/apache/gravitino/pull/9617#issuecomment-3747689681
@diqiu50 Sure,I will follow up
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#9581] fix(hive): Perform resource cleanup in HiveClientPool close [gravitino]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #9617:
URL: https://github.com/apache/gravitino/pull/9617#discussion_r2663499386
##########
catalogs/hive-metastore-common/src/test/java/org/apache/gravitino/hive/TestHiveClientPool.java:
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.gravitino.hive;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import com.google.common.collect.Lists;
+import java.util.List;
+import java.util.Properties;
+import org.apache.gravitino.exceptions.GravitinoRuntimeException;
+import org.apache.gravitino.hive.client.HiveClient;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
Review Comment:
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.
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#9581] fix(hive): Perform resource cleanup in HiveClientPool close [gravitino]
Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on PR #9617:
URL: https://github.com/apache/gravitino/pull/9617#issuecomment-3736685454
@diqiu50 Do u think that we should back port this pull request to branch 1.1?
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#9581] fix(hive): Perform resource cleanup in HiveClientPool close [gravitino]
Posted by "joeyutong (via GitHub)" <gi...@apache.org>.
joeyutong commented on PR #9617:
URL: https://github.com/apache/gravitino/pull/9617#issuecomment-3708783730
CC @diqiu50
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#9581] fix(hive): Perform resource cleanup in HiveClientPool close [gravitino]
Posted by "diqiu50 (via GitHub)" <gi...@apache.org>.
diqiu50 commented on code in PR #9617:
URL: https://github.com/apache/gravitino/pull/9617#discussion_r2663485441
##########
catalogs/hive-metastore-common/src/main/java/org/apache/gravitino/hive/HiveClientPool.java:
##########
@@ -56,12 +56,15 @@ protected HiveClient newClient() {
}
}
+ // Provides a no-op reconnect implementation because we rely on the RetryingMetaStoreClient
+ // to do the actual reconnect logic.
Review Comment:
Do we need to remove this TODO?
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#9581] fix(hive): Perform resource cleanup in HiveClientPool close [gravitino]
Posted by "diqiu50 (via GitHub)" <gi...@apache.org>.
diqiu50 merged PR #9617:
URL: https://github.com/apache/gravitino/pull/9617
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#9581] fix(hive): Perform resource cleanup in HiveClientPool close [gravitino]
Posted by "diqiu50 (via GitHub)" <gi...@apache.org>.
diqiu50 commented on code in PR #9617:
URL: https://github.com/apache/gravitino/pull/9617#discussion_r2663504493
##########
catalogs/hive-metastore-common/src/main/java/org/apache/gravitino/hive/HiveClientPool.java:
##########
@@ -56,12 +56,15 @@ protected HiveClient newClient() {
}
}
+ // Provides a no-op reconnect implementation because we rely on the RetryingMetaStoreClient
+ // to do the actual reconnect logic.
Review Comment:
Adjust the comment format for methods and classes.
##########
catalogs/hive-metastore-common/src/test/java/org/apache/gravitino/hive/TestHiveClientPool.java:
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.gravitino.hive;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import com.google.common.collect.Lists;
+import java.util.List;
+import java.util.Properties;
+import org.apache.gravitino.exceptions.GravitinoRuntimeException;
+import org.apache.gravitino.hive.client.HiveClient;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+
+// Referred from Apache Iceberg's TestHiveClientPool implementation
+// hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveClientPool.java
+public class TestHiveClientPool {
+
+ HiveClientPool clients;
Review Comment:
private
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#9581] fix(hive): Perform resource cleanup in HiveClientPool close [gravitino]
Posted by "diqiu50 (via GitHub)" <gi...@apache.org>.
diqiu50 commented on code in PR #9617:
URL: https://github.com/apache/gravitino/pull/9617#discussion_r2670632246
##########
catalogs/hive-metastore-common/src/test/java/org/apache/gravitino/hive/TestHiveClientPool.java:
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.gravitino.hive;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import com.google.common.collect.Lists;
+import java.util.List;
+import java.util.Properties;
+import org.apache.gravitino.exceptions.GravitinoRuntimeException;
+import org.apache.gravitino.hive.client.HiveClient;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+
+// Referred from Apache Iceberg's TestHiveClientPool implementation
+// hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveClientPool.java
+public class TestHiveClientPool {
Review Comment:
Please keep the comment style consistent of class
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#9581] fix(hive): Perform resource cleanup in HiveClientPool close [gravitino]
Posted by "diqiu50 (via GitHub)" <gi...@apache.org>.
diqiu50 commented on PR #9617:
URL: https://github.com/apache/gravitino/pull/9617#issuecomment-3741514865
> @diqiu50 Do u think that we should back port this pull request to branch 1.1?
Yes, I think so.
@joeyutong Can you create a PR to back port this to the branch 1.1
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#9581] fix(hive): Perform resource cleanup in HiveClientPool close [gravitino]
Posted by "joeyutong (via GitHub)" <gi...@apache.org>.
joeyutong commented on code in PR #9617:
URL: https://github.com/apache/gravitino/pull/9617#discussion_r2663495633
##########
catalogs/hive-metastore-common/src/main/java/org/apache/gravitino/hive/HiveClientPool.java:
##########
@@ -56,12 +56,15 @@ protected HiveClient newClient() {
}
}
+ // Provides a no-op reconnect implementation because we rely on the RetryingMetaStoreClient
+ // to do the actual reconnect logic.
Review Comment:
It is not a TODO. The second line is a continuation of the first line
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#9581] fix(hive): Perform resource cleanup in HiveClientPool close [gravitino]
Posted by "diqiu50 (via GitHub)" <gi...@apache.org>.
diqiu50 commented on code in PR #9617:
URL: https://github.com/apache/gravitino/pull/9617#discussion_r2670634669
##########
catalogs/hive-metastore-common/src/main/java/org/apache/gravitino/hive/HiveClientPool.java:
##########
@@ -56,12 +56,17 @@ protected HiveClient newClient() {
}
}
+ /**
+ * Provides a no-op reconnect implementation. Reconnect logic is handled by
+ * RetryingMetaStoreClient.
+ */
Review Comment:
This comment is not Javadoc for the function; please move it into the function body.
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org