This is an automated email from the ASF dual-hosted git repository. anishek pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push: new 565737a HIVE-24349:Client connection count is not printed correctly in HiveMetastoreClient(Arko Sharma, reviewed by Pravin Kumar Sinha) 565737a is described below commit 565737ac9426c61f0cb84329b649df9db6af791c Author: Anishek Agarwal <anis...@gmail.com> AuthorDate: Mon Nov 23 09:28:30 2020 +0530 HIVE-24349:Client connection count is not printed correctly in HiveMetastoreClient(Arko Sharma, reviewed by Pravin Kumar Sinha) --- .../java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java | 5 +++++ .../apache/hadoop/hive/metastore/HiveMetaStoreClientPreCatalog.java | 3 +++ 2 files changed, 8 insertions(+) diff --git a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java index 5d296dd..830e2e3 100644 --- a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java +++ b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java @@ -790,6 +790,11 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable { try { if (null != client) { client.shutdown(); + if ((transport == null) || !transport.isOpen()) { + final int newCount = connCount.decrementAndGet(); + LOG.info("Closed a connection to metastore, current connections: {}", + newCount); + } } } catch (TException e) { LOG.debug("Unable to shutdown metastore client. Will try closing transport directly.", e); diff --git a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClientPreCatalog.java b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClientPreCatalog.java index 7661ae65..54aaf18 100644 --- a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClientPreCatalog.java +++ b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClientPreCatalog.java @@ -599,6 +599,9 @@ public class HiveMetaStoreClientPreCatalog implements IMetaStoreClient, AutoClos try { if (null != client) { client.shutdown(); + if ((transport == null) || !transport.isOpen()) { + LOG.info("Closed a connection to metastore, current connections: " + connCount.decrementAndGet()); + } } } catch (TException e) { LOG.debug("Unable to shutdown metastore client. Will try closing transport directly.", e);