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

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

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


##########
llap-client/src/java/org/apache/hadoop/hive/llap/tez/LlapProtocolClientProxy.java:
##########
@@ -94,6 +105,35 @@ public void sendUpdateFragment(final 
UpdateFragmentRequestProto request, final S
     queueRequest(new SendUpdateFragmentCallable(nodeId, request, callback));
   }
 
+  protected void initPeriodicTokenRefresh(Configuration conf) {
+    if (!UserGroupInformation.isSecurityEnabled()) {
+      return;
+    }
+    long tokenRenewInterval =
+        HiveConf.getTimeVar(conf, 
ConfVars.LLAP_DELEGATION_TOKEN_RENEW_INTERVAL, TimeUnit.SECONDS);
+    // if the tokenRenewInterval is low (e.g. testing), let's use the half of 
it as interval instead of the constant
+    long interval = Math.min(tokenRenewInterval / 2, 
LLAP_TOKEN_REFRESH_INTERVAL_IN_AM_SECONDS);
+
+    LOG.info("Initializing periodic token refresh in AM, will run in every 
{}s", interval);
+    tokenClient = new LlapTokenClient(conf);
+
+    newTokenChecker.scheduleAtFixedRate(() -> {
+      fetchToken();
+    }, 0, interval, TimeUnit.SECONDS);
+  }
+
+  private synchronized void fetchToken() {
+    LOG.debug("Trying to fetch a new token...");
+    try {
+      Token<LlapTokenIdentifier> newToken =
+          tokenClient.withCurrentToken(new 
Token<LlapTokenIdentifier>(token)).getDelegationToken(null);
+      LOG.debug("Received new token: {}, old was: {}", newToken, token);

Review Comment:
   yes, it logs only public info about tokens by design, like:
   ```
    token (LLAP_TOKEN; LLAP_TOKEN 
owner=hive/[email protected], renewer=hive, realUser=, 
issueDate=1663838461176, maxDate=1663838521176, sequenceNumber=18, 
masterKeyId=18, cluster hive_compute-hive-lbodor, app ID , signing false)
   ```





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

    Worklog Id:     (was: 831438)
    Time Spent: 1h 50m  (was: 1h 40m)

> 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: 1h 50m
>  Remaining Estimate: 0h
>




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

Reply via email to