maropu commented on a change in pull request #28368:
URL: https://github.com/apache/spark/pull/28368#discussion_r416225641
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/connection/DB2ConnectionProvider.scala
##########
@@ -48,7 +48,7 @@ private[sql] class DB2ConnectionProvider(driver: Driver,
options: JDBCOptions)
result
}
- override def setAuthenticationConfigIfNeeded(): Unit = {
+ override def setAuthenticationConfigIfNeeded(): Unit =
SecurityConfigurationLock.synchronized {
Review comment:
> If the application name is the same then the second thread will not
overwrite it but just use it.
How about a different name case? That's what I wanna know. Since DataFrame
is thread-safe, I think the case can happen.
> Worth to mention all the originally existing configuration is still
reachable because if the searched application name is not matching with the
newly added entry then the entry delegates the call to the parent.
If this is true, the fix looks okay. What I was worried about is a time
sequence (t ~ t+3) below;
- t: A thread-1 sets a value at the global config to scan a secure
database-1.
- t+1: Just after the thread-1 setting, a thread-2 overrides it to scan a
secure database-2 (we assume the application names are different between each
other).
- t+2: The thread-1 opens a secure connection. // <-- Can the thread-1
refer the correct own configuration?
- t+3: The thread-2 opens it, too, then.
----------------------------------------------------------------
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]