This is an automated email from the ASF dual-hosted git repository.

ngangam 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 f9a25ed  HIVE-22095: Hive.get() resets the capabilities from HiveConf 
instead of set capabilities(Naveen Gangam, reviewed by Thejas Nair)
f9a25ed is described below

commit f9a25ed01f710cdadf8a86b0624832a0f7d9dd8d
Author: Naveen Gangam <[email protected]>
AuthorDate: Tue Aug 13 01:53:46 2019 -0400

    HIVE-22095: Hive.get() resets the capabilities from HiveConf instead of set 
capabilities(Naveen Gangam, reviewed by Thejas Nair)
---
 .../org/apache/hadoop/hive/ql/metadata/Hive.java   | 26 +++++++++++++++-------
 .../hadoop/hive/ql/session/SessionState.java       |  4 ++--
 .../hadoop/hive/metastore/HiveMetaStoreClient.java |  8 +++++++
 3 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java 
b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
index 0028818..21b1ef6 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
@@ -342,15 +342,17 @@ public class Hive {
     }
     c.set("fs.scheme.class", "dfs");
     Hive newdb = new Hive(c, doRegisterAllFns);
-    if (c.get(HiveConf.ConfVars.METASTORE_CLIENT_CAPABILITIES.varname) != 
null) {
-      String[] capabilities = 
c.get(HiveConf.ConfVars.METASTORE_CLIENT_CAPABILITIES.varname).split(",");
-      newdb.setHMSClientCapabilities(capabilities);
-      String hostName = "unknown";
-      try {
-        hostName = InetAddress.getLocalHost().getCanonicalHostName();
-      } catch (UnknownHostException ue) {
+    if (newdb.getHMSClientCapabilities() == null || 
newdb.getHMSClientCapabilities().length == 0) {
+      if (c.get(HiveConf.ConfVars.METASTORE_CLIENT_CAPABILITIES.varname) != 
null) {
+        String[] capabilities = 
c.get(HiveConf.ConfVars.METASTORE_CLIENT_CAPABILITIES.varname).split(",");
+        newdb.setHMSClientCapabilities(capabilities);
+        String hostName = "unknown";
+        try {
+          hostName = InetAddress.getLocalHost().getCanonicalHostName();
+        } catch (UnknownHostException ue) {
+        }
+        newdb.setHMSClientIdentifier("Hiveserver2#" + 
HiveVersionInfo.getVersion() + "@" + hostName);
       }
-      newdb.setHMSClientIdentifier("Hiveserver2#" + 
HiveVersionInfo.getVersion() + "@" + hostName);
     }
     hiveDB.set(newdb);
     return newdb;
@@ -369,6 +371,14 @@ public class Hive {
     HiveMetaStoreClient.setProcessorIdentifier(id);
   }
 
+  public String[] getHMSClientCapabilities() {
+    return HiveMetaStoreClient.getProcessorCapabilities();
+  }
+
+  public String getHMSClientIdentifier() {
+    return HiveMetaStoreClient.getProcessorIdentifier();
+  }
+
   private static boolean isCompatible(Hive db, HiveConf c, boolean 
isFastCheck) {
     if (isFastCheck) {
       return (db.metaStoreClient == null || 
db.metaStoreClient.isSameConfObj(c))
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java 
b/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
index 4632361..88a8919 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java
@@ -457,7 +457,7 @@ public class SessionState {
     final String currThreadName = Thread.currentThread().getName();
     if (!currThreadName.contains(logPrefix)) {
       final String newThreadName = logPrefix + " " + currThreadName;
-      LOG.info("Updating thread name to {}", newThreadName);
+      LOG.debug("Updating thread name to {}", newThreadName);
       Thread.currentThread().setName(newThreadName);
     }
   }
@@ -468,7 +468,7 @@ public class SessionState {
     final String currThreadName = Thread.currentThread().getName();
     if (currThreadName.contains(logPrefix)) {
       final String[] names = currThreadName.split(logPrefix);
-      LOG.info("Resetting thread name to {}", names[names.length - 1]);
+      LOG.debug("Resetting thread name to {}", names[names.length - 1]);
       Thread.currentThread().setName(names[names.length - 1].trim());
     }
   }
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 02b3af7..9b64028 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
@@ -733,6 +733,14 @@ public class HiveMetaStoreClient implements 
IMetaStoreClient, AutoCloseable {
     processorIdentifier = id;
   }
 
+  public static String[] getProcessorCapabilities() {
+    return processorCapabilities;
+  }
+
+  public static String getProcessorIdentifier() {
+    return processorIdentifier;
+  }
+
   @Override
   public void setMetaConf(String key, String value) throws TException {
     client.setMetaConf(key, value);

Reply via email to