You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2018/04/03 00:08:11 UTC

hive git commit: HIVE-19072 : incorrect token handling for LLAP plugin endpoint (Sergey Shelukhin, reviewed by Jason Dere)

Repository: hive
Updated Branches:
  refs/heads/master b849a166b -> 6751225a5


HIVE-19072 : incorrect token handling for LLAP plugin endpoint (Sergey Shelukhin, reviewed by Jason Dere)


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

Branch: refs/heads/master
Commit: 6751225a5cde4c40839df8b46e8d241fdda5cd34
Parents: b849a16
Author: sergey <se...@apache.org>
Authored: Mon Apr 2 17:01:11 2018 -0700
Committer: sergey <se...@apache.org>
Committed: Mon Apr 2 17:01:11 2018 -0700

----------------------------------------------------------------------
 .../java/org/apache/hadoop/hive/llap/AsyncPbRpcProxy.java | 10 +++++++++-
 .../apache/hadoop/hive/ql/exec/tez/WorkloadManager.java   |  2 ++
 2 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/6751225a/llap-common/src/java/org/apache/hadoop/hive/llap/AsyncPbRpcProxy.java
----------------------------------------------------------------------
diff --git a/llap-common/src/java/org/apache/hadoop/hive/llap/AsyncPbRpcProxy.java b/llap-common/src/java/org/apache/hadoop/hive/llap/AsyncPbRpcProxy.java
index 9f3ec38..35ed40c 100644
--- a/llap-common/src/java/org/apache/hadoop/hive/llap/AsyncPbRpcProxy.java
+++ b/llap-common/src/java/org/apache/hadoop/hive/llap/AsyncPbRpcProxy.java
@@ -14,6 +14,7 @@
 
 package org.apache.hadoop.hive.llap;
 
+import java.io.IOException;
 import java.security.PrivilegedAction;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -433,7 +434,8 @@ public abstract class AsyncPbRpcProxy<ProtocolType, TokenType extends TokenIdent
     }
   }
 
-  private ProtocolType createProxy(final LlapNodeId nodeId, Token<TokenType> nodeToken) {
+  private ProtocolType createProxy(
+      final LlapNodeId nodeId, Token<TokenType> nodeToken) throws IOException {
     if (nodeToken == null && token == null) {
       if (LOG.isDebugEnabled()) {
         LOG.debug("Creating a client without a token for " + nodeId);
@@ -441,6 +443,12 @@ public abstract class AsyncPbRpcProxy<ProtocolType, TokenType extends TokenIdent
       return createProtocolImpl(getConfig(), nodeId.getHostname(),
           nodeId.getPort(), null, retryPolicy, socketFactory);
     }
+    // Either the token should be passed in here, or in ctor.
+    String tokenUser = this.tokenUser == null ? getTokenUser(nodeToken) : this.tokenUser;
+    if (tokenUser == null) {
+      tokenUser = UserGroupInformation.getCurrentUser().getShortUserName();
+      LOG.warn("Cannot determine token user for UGI; using {}", tokenUser);
+    }
     final UserGroupInformation ugi = UserGroupInformation.createRemoteUser(tokenUser);
     // Clone the token as we'd need to set the service to the one we are talking to.
     if (nodeToken == null) {

http://git-wip-us.apache.org/repos/asf/hive/blob/6751225a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/WorkloadManager.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/WorkloadManager.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/WorkloadManager.java
index 65e3c82..97ba036 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/WorkloadManager.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/WorkloadManager.java
@@ -187,6 +187,8 @@ public class WorkloadManager extends TezSessionPoolSession.AbstractTriggerValida
     throws ExecutionException, InterruptedException {
     assert INSTANCE == null;
     // We could derive the expected number of AMs to pass in.
+    // Note: we pass a null token here; the tokens to talk to plugin endpoints will only be
+    //       known once the AMs register, and they are different for every AM (unlike LLAP token).
     LlapPluginEndpointClientImpl amComm = new LlapPluginEndpointClientImpl(conf, null, -1);
     QueryAllocationManager qam = new GuaranteedTasksAllocator(conf, amComm);
     return (INSTANCE = new WorkloadManager(amComm, yarnQueue, conf, qam, plan));