maropu commented on a change in pull request #31622:
URL: https://github.com/apache/spark/pull/31622#discussion_r581938058
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/connection/DB2ConnectionProvider.scala
##########
@@ -34,15 +35,22 @@ private[sql] class DB2ConnectionProvider extends
SecureConnectionProvider {
override def getConnection(driver: Driver, options: Map[String, String]):
Connection = {
val jdbcOptions = new JDBCOptions(options)
- setAuthenticationConfigIfNeeded(driver, jdbcOptions)
-
UserGroupInformation.loginUserFromKeytabAndReturnUGI(jdbcOptions.principal,
jdbcOptions.keytab)
- .doAs(
- new PrivilegedExceptionAction[Connection]() {
- override def run(): Connection = {
- DB2ConnectionProvider.super.getConnection(driver, options)
+ val parent = Configuration.getConfiguration
+ try {
+ setAuthenticationConfig(parent, driver, jdbcOptions)
+
UserGroupInformation.loginUserFromKeytabAndReturnUGI(jdbcOptions.principal,
+ jdbcOptions.keytab)
+ .doAs(
+ new PrivilegedExceptionAction[Connection]() {
+ override def run(): Connection = {
+ DB2ConnectionProvider.super.getConnection(driver, options)
+ }
}
- }
- )
+ )
+ } finally {
+ logDebug("Restoring original security configuration")
+ Configuration.setConfiguration(parent)
+ }
Review comment:
Ah, I see. Let's use the option 1. for now. Even if it is a development
api, I think it is better not to change it as much as possible
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]