You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by steveloughran <gi...@git.apache.org> on 2016/03/01 15:03:52 UTC

[GitHub] spark pull request: [SPARK-11182] HDFS Delegation Token will be ex...

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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org