Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/5031#discussion_r26796950
--- Diff: yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala ---
@@ -903,6 +908,30 @@ object Client extends Logging {
}
/**
+ * Obtains token for the Hive metastore and adds them to the credentials.
+ */
+ private def obtainTokenForHiveMetastore(conf: Configuration,
credentials: Credentials) {
+ if (UserGroupInformation.isSecurityEnabled /* And Hive is enabled */) {
+ val hc = org.apache.hadoop.hive.ql.metadata.Hive.get
+ val principal =
hc.getConf().get(HiveConf.ConfVars.METASTORE_KERBEROS_PRINCIPAL.varname)
+ val username = UserGroupInformation.getCurrentUser().getUserName
+
+ if (principal == null) {
+ val errorMessage = "Required hive metastore principal is not
configured!"
+ logError(errorMessage)
+ throw new IllegalArgumentException(errorMessage)
+ }
+
+ val tokenStr = hc.getDelegationToken(username,principal)
+ val hive2Token = new Token[DelegationTokenIdentifier]()
+ hive2Token.decodeFromUrlString(tokenStr)
+ credentials.addToken(new Text("hive.server2.delegation.token"),
hive2Token)
+ logDebug("Added the Hive Server 2 token to conf.")
+ org.apache.hadoop.hive.ql.metadata.Hive.closeCurrent
--- End diff --
Hbase needs its own delegation token, so I guess it wouldn't work either
without some code to fetch the token.
Regarding token expiry, especially for a long running process (let's say
the thrift server), it would require something similar to what Hari is doing in
#4688 .
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]