abstractdog commented on code in PR #3626:
URL: https://github.com/apache/hive/pull/3626#discussion_r1041216835


##########
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);

Review Comment:
   I see your point...yeah, the constant interval 
LLAP_TOKEN_REFRESH_INTERVAL_IN_AM_SECONDS is not supposed to be configured by 
the user, it's part of the token refresh internals (5mins period), and it's 
independent of the token renewal interval (which is by default much larger, 
days): it controls how quickly the AM reacts to the fact that there is some 
change in the token validity
   
   the idea here was that: let's say somebody is testing this feature (expert) 
and want to make it act quite quickly (within a minute), and we still don't 
want a separate config option for the LLAP_DELEGATION_TOKEN_RENEW_INTERVAL, 
instead, if tokenRenewInterval is low (60s), we can limit the actual interval 
to that (60s/2 = 30s), because it doesn't make sense to run with a 
tokenRenewInterval 1 minute but  running a periodic check with the original 
LLAP_DELEGATION_TOKEN_RENEW_INTERVAL, which is 5 mins
   
   I agree that this logic can be confusing, especially because in production 
the token renew interval should not be like minutes
   
   I think we can clarify this reason further with a code comment and/or remove 
this hack altogether, and have it like this:
   ```
   long interval = Math.min(tokenRenewInterval, 
LLAP_TOKEN_REFRESH_INTERVAL_IN_AM_SECONDS);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to