Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5307#discussion_r27931166
  
    --- Diff: 
yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala ---
    @@ -552,8 +558,47 @@ private[spark] class ApplicationMaster(
         }
       }
     
    +  /** set  "MapReduceShuffleToken" before registerAM
    +    * @return
    +    */
    +  private def initJobCredentialsAndUGI() = {
    +    val sc = sparkContextRef.get()
    +    val conf = if (sc != null) sc.getConf else sparkConf
    +    val isEncryptedShuffle = if (conf != null) {
    +      conf.getBoolean("spark.encrypted.shuffle", false)
    +    } else {
    +      false
    +    }
    +    if (isEncryptedShuffle) {
    +      val credentials = SparkHadoopUtil.get.getCurrentUserCredentials
    +      if (credentials.getSecretKey(SPARK_SHUFFLE_TOKEN) == null) {
    +        var keyGen: KeyGenerator = null
    +        try {
    +          val SHUFFLE_KEY_LENGTH: Int = 64
    +          var keyLen: Int = if 
(conf.getBoolean(SPARK_ENCRYPTED_INTERMEDIATE_DATA,
    +            DEFAULT_SPARK_ENCRYPTED_INTERMEDIATE_DATA) == true) {
    +            conf.getInt(SPARK_ENCRYPTED_INTERMEDIATE_DATA_KEY_SIZE_BITS,
    +              DEFAULT_SPARK_ENCRYPTED_INTERMEDIATE_DATA_KEY_SIZE_BITS)
    +          }
    +          else {
    +            SHUFFLE_KEY_LENGTH
    +          }
    +          val SHUFFLE_KEYGEN_ALGORITHM = "HmacSHA1";
    +          keyGen = KeyGenerator.getInstance(SHUFFLE_KEYGEN_ALGORITHM)
    +          keyGen.init(keyLen)
    +        }
    +        catch {
    +          case e: NoSuchAlgorithmException => println("Error generating 
shuffle secret key")
    --- End diff --
    
    Two things here. You shouldn't use `println` for errors. And if you 
actually hit an error here, you'll cause an NPE at line 593. So you probably 
should let this exception bubble up.


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

Reply via email to