hzxiongyinke commented on code in PR #4821:
URL: https://github.com/apache/hive/pull/4821#discussion_r1383419505


##########
ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java:
##########
@@ -765,6 +768,32 @@ private static void start(SessionState startSs, boolean 
isAsync, LogHelper conso
     }
   }
 
+  /**
+   * Set hive metastore delegation token in current UGI
+   */
+  private void setHiveMetastoreDelegationTokenToUGI() {
+    if (this.isHiveServerQuery) {
+      return;
+    }
+    if (!getSessionConf().getBoolVar(ConfVars.METASTORE_USE_THRIFT_SASL)) {
+      return;
+    }
+    try {
+      UserGroupInformation UGI = Utils.getUGI();
+      String hmsDelegationTokenStr = 
Hive.get().getDelegationToken(UGI.getShortUserName(), UGI.getShortUserName());

Review Comment:
   > If this new method is called from the Kerberos yarn client(which is 
kerberos based), and want to pass the HMS token to yarn job, some thoughts:
   > 
   > 1. what happen if the token being expired, should we get a new one?
   > 2. will the token in session config be propagated to the yarn job?
   > 
   > and I think we also need to check the client is kerberos based before 
fetching the dt: `UserGroupInformation.isSecurityEnabled()` As this is Iceberg 
specific, an alternative way is to move this part to `configureJobConf`: 
https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/metadata/HiveStorageHandler.java#L198
   
   1.if the token being expired , we can  do renew token such as  
https://github.com/apache/hive/blob/698194183a2cb4ee6bc528ee71462cbae2c2c7ad/service/src/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java#L142-L161
 .
   i am not sure should we do this.
   2.if token has set in UGI,new HMS client will check ConfVars.TOKEN_SIGNATURE 
for tokenSig.which ConfVars.TOKEN_SIGNATURE  has set in SessionState.so that we 
can connect to HMS (which is kerberos based) with HMS token
   



-- 
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