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

Reply via email to