spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerryshao <...@git.apache.org>
Subject [GitHub] spark pull request #16432: [SPARK-19021][YARN] Generailize HDFSCredentialPro...
Date Mon, 09 Jan 2017 05:38:31 GMT
Github user jerryshao commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16432#discussion_r95104079
  
    --- Diff: resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/security/HadoopFSCredentialProvider.scala
---
    @@ -56,14 +57,14 @@ private[security] class HDFSCredentialProvider extends ServiceCredentialProvider
         }
     
         // Get the time of next renewal.
    -    tokenRenewalInterval.map { interval =>
    -      creds.getAllTokens.asScala
    -        .filter(_.getKind == DelegationTokenIdentifier.HDFS_DELEGATION_KIND)
    +    tokenRenewalInterval.flatMap { interval =>
    +      val nextRenewalDates = creds.getAllTokens.asScala
    +        .filter(_.decodeIdentifier().isInstanceOf[AbstractDelegationTokenIdentifier])
             .map { t =>
    -          val identifier = new DelegationTokenIdentifier()
    -          identifier.readFields(new DataInputStream(new ByteArrayInputStream(t.getIdentifier)))
    +          val identifier = t.decodeIdentifier().asInstanceOf[AbstractDelegationTokenIdentifier]
               identifier.getIssueDate + interval
    -      }.foldLeft(0L)(math.max)
    +        }
    +      if (nextRenewalDates.isEmpty) None else Some(nextRenewalDates.min)
    --- End diff --
    
    I think the logic was incorrect previously, we should get the minimum renewal date, that's
why I changed here. But the code was probably OK if only we only have one default HDFS configured.



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


Mime
View raw message