You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by cw...@apache.org on 2016/05/11 21:31:09 UTC

hive git commit: HIVE-13363: Add hive.metastore.token.signature property to HiveConf (Anthony Hsu, reviewed by Carl Steinbach)

Repository: hive
Updated Branches:
  refs/heads/master 868413a37 -> 6187e2a6b


HIVE-13363: Add hive.metastore.token.signature property to HiveConf (Anthony Hsu, reviewed by Carl Steinbach)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/6187e2a6
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/6187e2a6
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/6187e2a6

Branch: refs/heads/master
Commit: 6187e2a6b2848c67070764c76cdbd62b13ff71f2
Parents: 868413a
Author: Carl Steinbach <cw...@apache.org>
Authored: Wed May 11 14:18:13 2016 -0700
Committer: Carl Steinbach <cw...@apache.org>
Committed: Wed May 11 14:24:44 2016 -0700

----------------------------------------------------------------------
 common/src/java/org/apache/hadoop/hive/conf/HiveConf.java         | 3 +++
 .../src/main/java/org/apache/hive/hcatalog/common/HCatUtil.java   | 2 +-
 .../org/apache/hive/hcatalog/templeton/SecureProxySupport.java    | 2 +-
 .../org/apache/hadoop/hive/thrift/TestHadoopAuthBridge23.java     | 2 +-
 .../org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java     | 2 +-
 .../apache/hive/service/cli/session/HiveSessionImplwithUGI.java   | 2 +-
 6 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/6187e2a6/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
----------------------------------------------------------------------
diff --git a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
index f509e8b..f2273c0 100644
--- a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
+++ b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
@@ -177,6 +177,7 @@ public class HiveConf extends Configuration {
       HiveConf.ConfVars.METASTORE_KERBEROS_KEYTAB_FILE,
       HiveConf.ConfVars.METASTORE_KERBEROS_PRINCIPAL,
       HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL,
+      HiveConf.ConfVars.METASTORE_TOKEN_SIGNATURE,
       HiveConf.ConfVars.METASTORE_CACHE_PINOBJTYPES,
       HiveConf.ConfVars.METASTORE_CONNECTION_POOLING_TYPE,
       HiveConf.ConfVars.METASTORE_VALIDATE_TABLES,
@@ -630,6 +631,8 @@ public class HiveConf extends Configuration {
     METASTORE_USE_THRIFT_COMPACT_PROTOCOL("hive.metastore.thrift.compact.protocol.enabled", false,
         "If true, the metastore Thrift interface will use TCompactProtocol. When false (default) TBinaryProtocol will be used.\n" +
         "Setting it to true will break compatibility with older clients running TBinaryProtocol."),
+    METASTORE_TOKEN_SIGNATURE("hive.metastore.token.signature", "",
+        "The delegation token service name to match when selecting a token from the current user's tokens."),
     METASTORE_CLUSTER_DELEGATION_TOKEN_STORE_CLS("hive.cluster.delegation.token.store.class",
         "org.apache.hadoop.hive.thrift.MemoryTokenStore",
         "The delegation token store implementation. Set to org.apache.hadoop.hive.thrift.ZooKeeperTokenStore for load-balanced cluster."),

http://git-wip-us.apache.org/repos/asf/hive/blob/6187e2a6/hcatalog/core/src/main/java/org/apache/hive/hcatalog/common/HCatUtil.java
----------------------------------------------------------------------
diff --git a/hcatalog/core/src/main/java/org/apache/hive/hcatalog/common/HCatUtil.java b/hcatalog/core/src/main/java/org/apache/hive/hcatalog/common/HCatUtil.java
index 3ee30ed..f3bfcfa 100644
--- a/hcatalog/core/src/main/java/org/apache/hive/hcatalog/common/HCatUtil.java
+++ b/hcatalog/core/src/main/java/org/apache/hive/hcatalog/common/HCatUtil.java
@@ -627,7 +627,7 @@ public class HCatUtil {
     }
 
     if (conf.get(HCatConstants.HCAT_KEY_TOKEN_SIGNATURE) != null) {
-      hiveConf.set("hive.metastore.token.signature",
+      hiveConf.setVar(HiveConf.ConfVars.METASTORE_TOKEN_SIGNATURE,
         conf.get(HCatConstants.HCAT_KEY_TOKEN_SIGNATURE));
     }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/6187e2a6/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/SecureProxySupport.java
----------------------------------------------------------------------
diff --git a/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/SecureProxySupport.java b/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/SecureProxySupport.java
index 13f3c9b..e71bc04 100644
--- a/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/SecureProxySupport.java
+++ b/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/SecureProxySupport.java
@@ -128,7 +128,7 @@ public class SecureProxySupport {
   public void addArgs(List<String> args) {
     if (isEnabled) {
       args.add("-D");
-      args.add("hive.metastore.token.signature=" + getHcatServiceStr());
+      args.add(HiveConf.ConfVars.METASTORE_TOKEN_SIGNATURE + "=" + getHcatServiceStr());
       args.add("-D");
       args.add("proxy.user.name=" + user);
     }

http://git-wip-us.apache.org/repos/asf/hive/blob/6187e2a6/itests/hive-unit-hadoop2/src/test/java/org/apache/hadoop/hive/thrift/TestHadoopAuthBridge23.java
----------------------------------------------------------------------
diff --git a/itests/hive-unit-hadoop2/src/test/java/org/apache/hadoop/hive/thrift/TestHadoopAuthBridge23.java b/itests/hive-unit-hadoop2/src/test/java/org/apache/hadoop/hive/thrift/TestHadoopAuthBridge23.java
index d07162b..c737bf5 100644
--- a/itests/hive-unit-hadoop2/src/test/java/org/apache/hadoop/hive/thrift/TestHadoopAuthBridge23.java
+++ b/itests/hive-unit-hadoop2/src/test/java/org/apache/hadoop/hive/thrift/TestHadoopAuthBridge23.java
@@ -352,7 +352,7 @@ public class TestHadoopAuthBridge23 extends TestCase {
         clientUgi.getShortUserName().equals(d.getUser().getShortUserName()));
 
     if (tokenSig != null) {
-      conf.set("hive.metastore.token.signature", tokenSig);
+      conf.setVar(HiveConf.ConfVars.METASTORE_TOKEN_SIGNATURE, tokenSig);
       t.setService(new Text(tokenSig));
     }
     //add the token to the clientUgi for securely talking to the metastore

http://git-wip-us.apache.org/repos/asf/hive/blob/6187e2a6/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
index 7bca797..682796d 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
@@ -432,7 +432,7 @@ public class HiveMetaStoreClient implements IMetaStoreClient {
               // this should happen on the map/reduce tasks if the client added the
               // tokens into hadoop's credential store in the front end during job
               // submission.
-              String tokenSig = conf.get("hive.metastore.token.signature");
+              String tokenSig = conf.getVar(ConfVars.METASTORE_TOKEN_SIGNATURE);
               // tokenSig could be null
               tokenStrForm = Utils.getTokenStrForm(tokenSig);
               if(tokenStrForm != null) {

http://git-wip-us.apache.org/repos/asf/hive/blob/6187e2a6/service/src/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java b/service/src/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java
index 025b0b8..f7b3412 100644
--- a/service/src/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java
+++ b/service/src/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java
@@ -115,7 +115,7 @@ public class HiveSessionImplwithUGI extends HiveSessionImpl {
   private void setDelegationToken(String hmsDelegationTokenStr) throws HiveSQLException {
     this.hmsDelegationTokenStr = hmsDelegationTokenStr;
     if (hmsDelegationTokenStr != null) {
-      getHiveConf().set("hive.metastore.token.signature", HS2TOKEN);
+      getHiveConf().setVar(HiveConf.ConfVars.METASTORE_TOKEN_SIGNATURE, HS2TOKEN);
       try {
         Utils.setTokenStr(sessionUgi, hmsDelegationTokenStr, HS2TOKEN);
       } catch (IOException e) {