Github user steveloughran commented on a diff in the pull request:
https://github.com/apache/spark/pull/9168#discussion_r54569902
--- Diff: core/src/main/scala/org/apache/spark/deploy/SparkHadoopUtil.scala
---
@@ -130,6 +130,21 @@ class SparkHadoopUtil extends Logging {
UserGroupInformation.loginUserFromKeytab(principalName, keytabFilename)
}
+ def addCredentialsToCurrentUser(credentials: Credentials,
freshHadoopConf: Configuration): Unit ={
+ UserGroupInformation.getCurrentUser.addCredentials(credentials)
+
+ // HACK:
+ // In HA mode, the function FileSystem.addDelegationTokens only
returns a token for HA
+ // NameNode. HDFS Client will generate private tokens for each
NameNode according to the
+ // token for HA NameNode and uses these private tokens to communicate
with each NameNode.
+ // If spark only update token for HA NameNode, HDFS Client will use
the old private tokens,
+ // which will cause token expired Error.
+ // So:
+ // We create a new HDFS Client, so that the new HDFS Client will
generate and update the
+ // private tokens for each NameNode.
+ FileSystem.get(freshHadoopConf).close()
--- End diff --
turns out that `FileSystem.newInstance()` can also be used. This is Hadoop
2.x+, so can't be used in code that's also designed to compile against Hadoop
1.x
---
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]