[SPARK-41719][CORE] Skip SSLOptions sub-settings if ssl is disabled#39221
[SPARK-41719][CORE] Skip SSLOptions sub-settings if ssl is disabled#39221shrprasa wants to merge 2 commits intoapache:masterfrom
ssl is disabled#39221Conversation
…y when ssl is enabled
|
Can one of the admins verify this patch? |
|
@dongjoon-hyun @holdenk @squito, @HyukjinKwon @yaooqinn Can you please review this PR? |
dongjoon-hyun
left a comment
There was a problem hiding this comment.
In this case, Apache Spark coding style allows the exceptional return statement.
You can do the following simply.
if (!enabled) {
return new SSLOptions(false)
}
dongjoon-hyun
left a comment
There was a problem hiding this comment.
Thank you for making a PR, @shrprasa . I finished the first round review. Could you address the comments?
ssl is disabled
|
@dongjoon-hyun Thank you for reviewing the PR. I have made the suggested changes. Can you please review. |
dongjoon-hyun
left a comment
There was a problem hiding this comment.
+1, LGTM. Thank you for updating and explanation, @shrprasa .
Merged to master for Apache Spark 3.4.0.
|
I added you to the Apache Spark contributor group and assigned SPARK-41719 to you. |
|
BTW, here is a tip for new comers. If you add your commit email, https://github.com/apache/spark/commits/master |
|
@dongjoon-hyun Thank you for approving and merging the PR. I have added commit email in github account. |

What changes were proposed in this pull request?
In SSLOptions rest of the settings should be set only when ssl is enabled.
Why are the changes needed?
If spark.ssl.enabled is false, there is no use of setting rest of spark.ssl.* settings in SSLOptions as this requires unnecessary operations to be performed to set these properties.
Additional implication of trying to set the rest of settings is if any error occurs in setting these properties it will cause job failure which otherwise should have worked since ssl is disabled. For example, if the user doesn't have access to the keystore path which is set in hadoop.security.credential.provider.path of hive-site.xml, it can result in failure while launching spark shell since SSLOptions won't be initialized due to error in accessing the keystore.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Added new test.