Github user marsishandsome commented on a diff in the pull request: https://github.com/apache/spark/pull/9168#discussion_r42826304 --- 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 -- Good Idea. I will refactor the patch after HDFS-9276 is fixed.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org