[ 
https://issues.apache.org/jira/browse/HIVE-26569?focusedWorklogId=831481&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-831481
 ]

ASF GitHub Bot logged work on HIVE-26569:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 06/Dec/22 16:37
            Start Date: 06/Dec/22 16:37
    Worklog Time Spent: 10m 
      Work Description: abstractdog commented on code in PR #3626:
URL: https://github.com/apache/hive/pull/3626#discussion_r1041203596


##########
llap-client/src/java/org/apache/hadoop/hive/llap/security/LlapTokenClient.java:
##########
@@ -117,10 +121,72 @@ private Token<LlapTokenIdentifier> 
extractToken(ByteString tokenBytes) throws IO
 
   private ByteString getTokenBytes(final String appId) throws IOException, 
ServiceException {
     assert clientInstance != null;
+    if (currentToken != null) {
+      try {
+        return fetchTokenWithCurrentToken(appId);
+      } catch (Exception e) {
+        LOG.error("IOException while getting delgation token, trying with 
kerberos login", e);
+        return fetchTokenWithKerberosLogin(appId);
+      }
+    } else {
+      LOG.info("currentToken is null, let's try to fetch one with kerberos 
login");
+      return fetchTokenWithKerberosLogin(appId);
+    }
+  }
+
+  /**
+   * Tries to fetch token by LlapManagementProtocolClientImpl from a daemon on 
the cluster.
+   * Assumes that we already have a valid currentToken for communicating with 
the daemons.
+   */
+  private ByteString fetchTokenWithCurrentToken(final String appId) throws 
IOException, ServiceException {
+    UserGroupInformation ugi = getUgiWithCurrentToken();
+    return getTokenWithUgi(appId, ugi);
+  }
+
+  /**
+   * Tries to fetch token by LlapManagementProtocolClientImpl with a kerberos 
login.
+   * 1. Logs in to kerberos
+   * 2. Obtains an authenticated ugi
+   * 3. Fetches a delegation token from a deamon.

Review Comment:
   ack





Issue Time Tracking
-------------------

    Worklog Id:     (was: 831481)
    Time Spent: 2h  (was: 1h 50m)

> Support renewal and recreation of LLAP_TOKENs
> ---------------------------------------------
>
>                 Key: HIVE-26569
>                 URL: https://issues.apache.org/jira/browse/HIVE-26569
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: László Bodor
>            Assignee: László Bodor
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to