You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/06/10 13:09:41 UTC
[GitHub] [spark] haiyangsun-db opened a new pull request #32865: [WIP][SPARK-35701] Use copy-on-write semantics for SQLConf registered configurations.
haiyangsun-db opened a new pull request #32865:
URL: https://github.com/apache/spark/pull/32865
### What changes were proposed in this pull request?
Using copy-on-write for `SQLConf.sqlConfEntries` and `SQLConf.staticConfKeys` to reduce contention in concurrent workloads.
### Why are the changes needed?
The global locks used to protect `SQLConf.sqlConfEntries` map and the `SQLConf.staticConfKeys` set can cause significant contention on the `SQLConf` instance in a concurrent setting.
Using copy-on-write versions should reduce the contention given that modifications to the configs are relatively rare.
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #32865: [SPARK-35701] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-858721842
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/44166/
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #32865: [SPARK-35701][SQL] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-859503461
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #32865: [SPARK-35701] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-858695403
Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/44166/
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #32865: [WIP][SPARK-35701] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-858666202
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/44166/
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #32865: [SPARK-35701] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-858721842
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/44166/
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #32865: [SPARK-35701][SQL] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-859502489
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #32865: [WIP][SPARK-35701] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-858625579
Can one of the admins verify this patch?
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #32865: [WIP][SPARK-35701] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-858625579
Can one of the admins verify this patch?
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dongjoon-hyun commented on a change in pull request #32865: [SPARK-35701][SQL] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #32865:
URL: https://github.com/apache/spark/pull/32865#discussion_r649661180
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -53,28 +54,60 @@ import org.apache.spark.util.Utils
object SQLConf {
- private[sql] val sqlConfEntries =
- new ConcurrentHashMap[String, ConfigEntry[_]]()
+ private[this] val sqlConfEntriesUpdateLock = new Object
- val staticConfKeys: java.util.Set[String] =
- java.util.Collections.synchronizedSet(new java.util.HashSet[String]())
+ @volatile
+ private[this] var sqlConfEntries: util.Map[String, ConfigEntry[_]] = util.Collections.emptyMap()
- private def register(entry: ConfigEntry[_]): Unit = sqlConfEntries.merge(entry.key, entry,
- (existingConfigEntry, newConfigEntry) => {
- require(existingConfigEntry == null,
- s"Duplicate SQLConfigEntry. ${newConfigEntry.key} has been registered")
- newConfigEntry
- }
- )
+ private[this] val staticConfKeysUpdateLock = new Object
+
+ @volatile
+ private[this] var staticConfKeys: java.util.Set[String] = util.Collections.emptySet()
+
+ private def register(entry: ConfigEntry[_]): Unit = sqlConfEntriesUpdateLock.synchronized {
+ require(!sqlConfEntries.containsKey(entry.key),
+ s"Duplicate SQLConfigEntry. ${entry.key} has been registered")
+ val updatedMap = new java.util.HashMap[String, ConfigEntry[_]](sqlConfEntries)
+ updatedMap.put(entry.key, entry)
+ sqlConfEntries = updatedMap
+ }
// For testing only
- private[sql] def unregister(entry: ConfigEntry[_]): Unit = sqlConfEntries.remove(entry.key)
+ private[sql] def unregister(entry: ConfigEntry[_]): Unit = sqlConfEntriesUpdateLock.synchronized {
+ val updatedMap = new java.util.HashMap[String, ConfigEntry[_]](sqlConfEntries)
+ updatedMap.remove(entry.key)
+ sqlConfEntries = updatedMap
+ }
+
+ private[internal] def getConfigEntry(key: String): ConfigEntry[_] = {
Review comment:
Is `private` enough?
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -53,28 +54,60 @@ import org.apache.spark.util.Utils
object SQLConf {
- private[sql] val sqlConfEntries =
- new ConcurrentHashMap[String, ConfigEntry[_]]()
+ private[this] val sqlConfEntriesUpdateLock = new Object
- val staticConfKeys: java.util.Set[String] =
- java.util.Collections.synchronizedSet(new java.util.HashSet[String]())
+ @volatile
+ private[this] var sqlConfEntries: util.Map[String, ConfigEntry[_]] = util.Collections.emptyMap()
- private def register(entry: ConfigEntry[_]): Unit = sqlConfEntries.merge(entry.key, entry,
- (existingConfigEntry, newConfigEntry) => {
- require(existingConfigEntry == null,
- s"Duplicate SQLConfigEntry. ${newConfigEntry.key} has been registered")
- newConfigEntry
- }
- )
+ private[this] val staticConfKeysUpdateLock = new Object
+
+ @volatile
+ private[this] var staticConfKeys: java.util.Set[String] = util.Collections.emptySet()
+
+ private def register(entry: ConfigEntry[_]): Unit = sqlConfEntriesUpdateLock.synchronized {
+ require(!sqlConfEntries.containsKey(entry.key),
+ s"Duplicate SQLConfigEntry. ${entry.key} has been registered")
+ val updatedMap = new java.util.HashMap[String, ConfigEntry[_]](sqlConfEntries)
+ updatedMap.put(entry.key, entry)
+ sqlConfEntries = updatedMap
+ }
// For testing only
- private[sql] def unregister(entry: ConfigEntry[_]): Unit = sqlConfEntries.remove(entry.key)
+ private[sql] def unregister(entry: ConfigEntry[_]): Unit = sqlConfEntriesUpdateLock.synchronized {
+ val updatedMap = new java.util.HashMap[String, ConfigEntry[_]](sqlConfEntries)
+ updatedMap.remove(entry.key)
+ sqlConfEntries = updatedMap
+ }
+
+ private[internal] def getConfigEntry(key: String): ConfigEntry[_] = {
+ sqlConfEntries.get(key)
+ }
+
+ private[internal] def getConfigEntries(): util.Collection[ConfigEntry[_]] = {
Review comment:
ditto.
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -53,28 +54,60 @@ import org.apache.spark.util.Utils
object SQLConf {
- private[sql] val sqlConfEntries =
- new ConcurrentHashMap[String, ConfigEntry[_]]()
+ private[this] val sqlConfEntriesUpdateLock = new Object
- val staticConfKeys: java.util.Set[String] =
- java.util.Collections.synchronizedSet(new java.util.HashSet[String]())
+ @volatile
+ private[this] var sqlConfEntries: util.Map[String, ConfigEntry[_]] = util.Collections.emptyMap()
- private def register(entry: ConfigEntry[_]): Unit = sqlConfEntries.merge(entry.key, entry,
- (existingConfigEntry, newConfigEntry) => {
- require(existingConfigEntry == null,
- s"Duplicate SQLConfigEntry. ${newConfigEntry.key} has been registered")
- newConfigEntry
- }
- )
+ private[this] val staticConfKeysUpdateLock = new Object
+
+ @volatile
+ private[this] var staticConfKeys: java.util.Set[String] = util.Collections.emptySet()
+
+ private def register(entry: ConfigEntry[_]): Unit = sqlConfEntriesUpdateLock.synchronized {
+ require(!sqlConfEntries.containsKey(entry.key),
+ s"Duplicate SQLConfigEntry. ${entry.key} has been registered")
+ val updatedMap = new java.util.HashMap[String, ConfigEntry[_]](sqlConfEntries)
+ updatedMap.put(entry.key, entry)
+ sqlConfEntries = updatedMap
+ }
// For testing only
- private[sql] def unregister(entry: ConfigEntry[_]): Unit = sqlConfEntries.remove(entry.key)
+ private[sql] def unregister(entry: ConfigEntry[_]): Unit = sqlConfEntriesUpdateLock.synchronized {
+ val updatedMap = new java.util.HashMap[String, ConfigEntry[_]](sqlConfEntries)
+ updatedMap.remove(entry.key)
+ sqlConfEntries = updatedMap
+ }
+
+ private[internal] def getConfigEntry(key: String): ConfigEntry[_] = {
Review comment:
~Is `private` enough?~ Never mind~
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -53,28 +54,60 @@ import org.apache.spark.util.Utils
object SQLConf {
- private[sql] val sqlConfEntries =
- new ConcurrentHashMap[String, ConfigEntry[_]]()
+ private[this] val sqlConfEntriesUpdateLock = new Object
- val staticConfKeys: java.util.Set[String] =
- java.util.Collections.synchronizedSet(new java.util.HashSet[String]())
+ @volatile
+ private[this] var sqlConfEntries: util.Map[String, ConfigEntry[_]] = util.Collections.emptyMap()
- private def register(entry: ConfigEntry[_]): Unit = sqlConfEntries.merge(entry.key, entry,
- (existingConfigEntry, newConfigEntry) => {
- require(existingConfigEntry == null,
- s"Duplicate SQLConfigEntry. ${newConfigEntry.key} has been registered")
- newConfigEntry
- }
- )
+ private[this] val staticConfKeysUpdateLock = new Object
+
+ @volatile
+ private[this] var staticConfKeys: java.util.Set[String] = util.Collections.emptySet()
+
+ private def register(entry: ConfigEntry[_]): Unit = sqlConfEntriesUpdateLock.synchronized {
+ require(!sqlConfEntries.containsKey(entry.key),
+ s"Duplicate SQLConfigEntry. ${entry.key} has been registered")
+ val updatedMap = new java.util.HashMap[String, ConfigEntry[_]](sqlConfEntries)
+ updatedMap.put(entry.key, entry)
+ sqlConfEntries = updatedMap
+ }
// For testing only
- private[sql] def unregister(entry: ConfigEntry[_]): Unit = sqlConfEntries.remove(entry.key)
+ private[sql] def unregister(entry: ConfigEntry[_]): Unit = sqlConfEntriesUpdateLock.synchronized {
+ val updatedMap = new java.util.HashMap[String, ConfigEntry[_]](sqlConfEntries)
+ updatedMap.remove(entry.key)
+ sqlConfEntries = updatedMap
+ }
+
+ private[internal] def getConfigEntry(key: String): ConfigEntry[_] = {
+ sqlConfEntries.get(key)
+ }
+
+ private[internal] def getConfigEntries(): util.Collection[ConfigEntry[_]] = {
+ sqlConfEntries.values()
+ }
+
+ private[internal] def containsConfigEntry(entry: ConfigEntry[_]): Boolean = {
+ getConfigEntry(entry.key) == entry
+ }
+ private[sql] def containsConfigKey(key: String): Boolean = {
Review comment:
indentation?
Also, please add a new line before this.
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -53,28 +54,60 @@ import org.apache.spark.util.Utils
object SQLConf {
- private[sql] val sqlConfEntries =
- new ConcurrentHashMap[String, ConfigEntry[_]]()
+ private[this] val sqlConfEntriesUpdateLock = new Object
- val staticConfKeys: java.util.Set[String] =
- java.util.Collections.synchronizedSet(new java.util.HashSet[String]())
+ @volatile
+ private[this] var sqlConfEntries: util.Map[String, ConfigEntry[_]] = util.Collections.emptyMap()
- private def register(entry: ConfigEntry[_]): Unit = sqlConfEntries.merge(entry.key, entry,
- (existingConfigEntry, newConfigEntry) => {
- require(existingConfigEntry == null,
- s"Duplicate SQLConfigEntry. ${newConfigEntry.key} has been registered")
- newConfigEntry
- }
- )
+ private[this] val staticConfKeysUpdateLock = new Object
+
+ @volatile
+ private[this] var staticConfKeys: java.util.Set[String] = util.Collections.emptySet()
+
+ private def register(entry: ConfigEntry[_]): Unit = sqlConfEntriesUpdateLock.synchronized {
+ require(!sqlConfEntries.containsKey(entry.key),
+ s"Duplicate SQLConfigEntry. ${entry.key} has been registered")
+ val updatedMap = new java.util.HashMap[String, ConfigEntry[_]](sqlConfEntries)
+ updatedMap.put(entry.key, entry)
+ sqlConfEntries = updatedMap
+ }
// For testing only
- private[sql] def unregister(entry: ConfigEntry[_]): Unit = sqlConfEntries.remove(entry.key)
+ private[sql] def unregister(entry: ConfigEntry[_]): Unit = sqlConfEntriesUpdateLock.synchronized {
+ val updatedMap = new java.util.HashMap[String, ConfigEntry[_]](sqlConfEntries)
+ updatedMap.remove(entry.key)
+ sqlConfEntries = updatedMap
+ }
+
+ private[internal] def getConfigEntry(key: String): ConfigEntry[_] = {
+ sqlConfEntries.get(key)
+ }
+
+ private[internal] def getConfigEntries(): util.Collection[ConfigEntry[_]] = {
+ sqlConfEntries.values()
+ }
+
+ private[internal] def containsConfigEntry(entry: ConfigEntry[_]): Boolean = {
+ getConfigEntry(entry.key) == entry
+ }
+ private[sql] def containsConfigKey(key: String): Boolean = {
Review comment:
indentation?
Also, please add a new line before this function.
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] viirya commented on pull request #32865: [SPARK-35701][SQL] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
viirya commented on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-860079395
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] HyukjinKwon commented on pull request #32865: [SPARK-35701][SQL] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-859229525
BTW, seems like the GA tests were not triggered for some reasons ..
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #32865: [SPARK-35701] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-858878901
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139640/
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #32865: [WIP][SPARK-35701] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-858674125
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/44168/
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #32865: [SPARK-35701] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-858629201
**[Test build #139640 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139640/testReport)** for PR 32865 at commit [`f3fad1d`](https://github.com/apache/spark/commit/f3fad1ddcecca97a2e0ceabe8b79aab81fcf0a35).
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #32865: [SPARK-35701] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-858768600
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/44168/
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] haiyangsun-db commented on pull request #32865: [SPARK-35701][SQL] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
haiyangsun-db commented on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-859350677
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #32865: [SPARK-35701] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-858768600
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/44168/
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] hvanhovell commented on pull request #32865: [WIP][SPARK-35701] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
hvanhovell commented on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-858626930
jenkins add to whitelist
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] viirya commented on a change in pull request #32865: [SPARK-35701][SQL] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
viirya commented on a change in pull request #32865:
URL: https://github.com/apache/spark/pull/32865#discussion_r649662712
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -53,28 +54,60 @@ import org.apache.spark.util.Utils
object SQLConf {
- private[sql] val sqlConfEntries =
- new ConcurrentHashMap[String, ConfigEntry[_]]()
+ private[this] val sqlConfEntriesUpdateLock = new Object
- val staticConfKeys: java.util.Set[String] =
- java.util.Collections.synchronizedSet(new java.util.HashSet[String]())
+ @volatile
+ private[this] var sqlConfEntries: util.Map[String, ConfigEntry[_]] = util.Collections.emptyMap()
- private def register(entry: ConfigEntry[_]): Unit = sqlConfEntries.merge(entry.key, entry,
- (existingConfigEntry, newConfigEntry) => {
- require(existingConfigEntry == null,
- s"Duplicate SQLConfigEntry. ${newConfigEntry.key} has been registered")
- newConfigEntry
- }
- )
+ private[this] val staticConfKeysUpdateLock = new Object
+
+ @volatile
+ private[this] var staticConfKeys: java.util.Set[String] = util.Collections.emptySet()
+
+ private def register(entry: ConfigEntry[_]): Unit = sqlConfEntriesUpdateLock.synchronized {
+ require(!sqlConfEntries.containsKey(entry.key),
+ s"Duplicate SQLConfigEntry. ${entry.key} has been registered")
+ val updatedMap = new java.util.HashMap[String, ConfigEntry[_]](sqlConfEntries)
+ updatedMap.put(entry.key, entry)
+ sqlConfEntries = updatedMap
+ }
// For testing only
- private[sql] def unregister(entry: ConfigEntry[_]): Unit = sqlConfEntries.remove(entry.key)
+ private[sql] def unregister(entry: ConfigEntry[_]): Unit = sqlConfEntriesUpdateLock.synchronized {
+ val updatedMap = new java.util.HashMap[String, ConfigEntry[_]](sqlConfEntries)
+ updatedMap.remove(entry.key)
+ sqlConfEntries = updatedMap
+ }
+
+ private[internal] def getConfigEntry(key: String): ConfigEntry[_] = {
+ sqlConfEntries.get(key)
+ }
+
+ private[internal] def getConfigEntries(): util.Collection[ConfigEntry[_]] = {
+ sqlConfEntries.values()
+ }
+
+ private[internal] def containsConfigEntry(entry: ConfigEntry[_]): Boolean = {
+ getConfigEntry(entry.key) == entry
+ }
+ private[sql] def containsConfigKey(key: String): Boolean = {
+ sqlConfEntries.containsKey(key)
+ }
Review comment:
incorrect indentation?
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #32865: [SPARK-35701] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-858850408
**[Test build #139640 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139640/testReport)** for PR 32865 at commit [`f3fad1d`](https://github.com/apache/spark/commit/f3fad1ddcecca97a2e0ceabe8b79aab81fcf0a35).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #32865: [SPARK-35701] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #32865:
URL: https://github.com/apache/spark/pull/32865#discussion_r649630875
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -53,28 +54,60 @@ import org.apache.spark.util.Utils
object SQLConf {
- private[sql] val sqlConfEntries =
- new ConcurrentHashMap[String, ConfigEntry[_]]()
+ private[this] val sqlConfEntriesUpdateLock = new Object
- val staticConfKeys: java.util.Set[String] =
- java.util.Collections.synchronizedSet(new java.util.HashSet[String]())
+ @volatile
+ private[this] var sqlConfEntries: util.Map[String, ConfigEntry[_]] = util.Collections.emptyMap()
- private def register(entry: ConfigEntry[_]): Unit = sqlConfEntries.merge(entry.key, entry,
- (existingConfigEntry, newConfigEntry) => {
- require(existingConfigEntry == null,
- s"Duplicate SQLConfigEntry. ${newConfigEntry.key} has been registered")
- newConfigEntry
- }
- )
+ private[this] val staticConfKeysUpdateLock = new Object
Review comment:
Q: we need the two separate locks for the static/non-static configs?
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #32865: [SPARK-35701][SQL] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-860079786
**[Test build #139741 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139741/testReport)** for PR 32865 at commit [`994cab2`](https://github.com/apache/spark/commit/994cab24f91d681f187b3062da0de62a45b0ba6a).
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #32865: [WIP][SPARK-35701] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-858629201
**[Test build #139640 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139640/testReport)** for PR 32865 at commit [`f3fad1d`](https://github.com/apache/spark/commit/f3fad1ddcecca97a2e0ceabe8b79aab81fcf0a35).
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] haiyangsun-db commented on a change in pull request #32865: [SPARK-35701][SQL] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
haiyangsun-db commented on a change in pull request #32865:
URL: https://github.com/apache/spark/pull/32865#discussion_r649750350
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -53,28 +54,60 @@ import org.apache.spark.util.Utils
object SQLConf {
- private[sql] val sqlConfEntries =
- new ConcurrentHashMap[String, ConfigEntry[_]]()
+ private[this] val sqlConfEntriesUpdateLock = new Object
- val staticConfKeys: java.util.Set[String] =
- java.util.Collections.synchronizedSet(new java.util.HashSet[String]())
+ @volatile
+ private[this] var sqlConfEntries: util.Map[String, ConfigEntry[_]] = util.Collections.emptyMap()
- private def register(entry: ConfigEntry[_]): Unit = sqlConfEntries.merge(entry.key, entry,
- (existingConfigEntry, newConfigEntry) => {
- require(existingConfigEntry == null,
- s"Duplicate SQLConfigEntry. ${newConfigEntry.key} has been registered")
- newConfigEntry
- }
- )
+ private[this] val staticConfKeysUpdateLock = new Object
Review comment:
These are two different sets of configs, so using two separate locks should be better.
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -53,28 +54,60 @@ import org.apache.spark.util.Utils
object SQLConf {
- private[sql] val sqlConfEntries =
- new ConcurrentHashMap[String, ConfigEntry[_]]()
+ private[this] val sqlConfEntriesUpdateLock = new Object
- val staticConfKeys: java.util.Set[String] =
- java.util.Collections.synchronizedSet(new java.util.HashSet[String]())
+ @volatile
+ private[this] var sqlConfEntries: util.Map[String, ConfigEntry[_]] = util.Collections.emptyMap()
- private def register(entry: ConfigEntry[_]): Unit = sqlConfEntries.merge(entry.key, entry,
- (existingConfigEntry, newConfigEntry) => {
- require(existingConfigEntry == null,
- s"Duplicate SQLConfigEntry. ${newConfigEntry.key} has been registered")
- newConfigEntry
- }
- )
+ private[this] val staticConfKeysUpdateLock = new Object
+
+ @volatile
+ private[this] var staticConfKeys: java.util.Set[String] = util.Collections.emptySet()
+
+ private def register(entry: ConfigEntry[_]): Unit = sqlConfEntriesUpdateLock.synchronized {
+ require(!sqlConfEntries.containsKey(entry.key),
+ s"Duplicate SQLConfigEntry. ${entry.key} has been registered")
+ val updatedMap = new java.util.HashMap[String, ConfigEntry[_]](sqlConfEntries)
+ updatedMap.put(entry.key, entry)
+ sqlConfEntries = updatedMap
+ }
// For testing only
- private[sql] def unregister(entry: ConfigEntry[_]): Unit = sqlConfEntries.remove(entry.key)
+ private[sql] def unregister(entry: ConfigEntry[_]): Unit = sqlConfEntriesUpdateLock.synchronized {
+ val updatedMap = new java.util.HashMap[String, ConfigEntry[_]](sqlConfEntries)
+ updatedMap.remove(entry.key)
+ sqlConfEntries = updatedMap
+ }
+
+ private[internal] def getConfigEntry(key: String): ConfigEntry[_] = {
+ sqlConfEntries.get(key)
+ }
+
+ private[internal] def getConfigEntries(): util.Collection[ConfigEntry[_]] = {
+ sqlConfEntries.values()
+ }
+
+ private[internal] def containsConfigEntry(entry: ConfigEntry[_]): Boolean = {
+ getConfigEntry(entry.key) == entry
+ }
+ private[sql] def containsConfigKey(key: String): Boolean = {
Review comment:
Fixed, thank you!
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -53,28 +54,60 @@ import org.apache.spark.util.Utils
object SQLConf {
- private[sql] val sqlConfEntries =
- new ConcurrentHashMap[String, ConfigEntry[_]]()
+ private[this] val sqlConfEntriesUpdateLock = new Object
- val staticConfKeys: java.util.Set[String] =
- java.util.Collections.synchronizedSet(new java.util.HashSet[String]())
+ @volatile
+ private[this] var sqlConfEntries: util.Map[String, ConfigEntry[_]] = util.Collections.emptyMap()
- private def register(entry: ConfigEntry[_]): Unit = sqlConfEntries.merge(entry.key, entry,
- (existingConfigEntry, newConfigEntry) => {
- require(existingConfigEntry == null,
- s"Duplicate SQLConfigEntry. ${newConfigEntry.key} has been registered")
- newConfigEntry
- }
- )
+ private[this] val staticConfKeysUpdateLock = new Object
+
+ @volatile
+ private[this] var staticConfKeys: java.util.Set[String] = util.Collections.emptySet()
+
+ private def register(entry: ConfigEntry[_]): Unit = sqlConfEntriesUpdateLock.synchronized {
+ require(!sqlConfEntries.containsKey(entry.key),
+ s"Duplicate SQLConfigEntry. ${entry.key} has been registered")
+ val updatedMap = new java.util.HashMap[String, ConfigEntry[_]](sqlConfEntries)
+ updatedMap.put(entry.key, entry)
+ sqlConfEntries = updatedMap
+ }
// For testing only
- private[sql] def unregister(entry: ConfigEntry[_]): Unit = sqlConfEntries.remove(entry.key)
+ private[sql] def unregister(entry: ConfigEntry[_]): Unit = sqlConfEntriesUpdateLock.synchronized {
+ val updatedMap = new java.util.HashMap[String, ConfigEntry[_]](sqlConfEntries)
+ updatedMap.remove(entry.key)
+ sqlConfEntries = updatedMap
+ }
+
+ private[internal] def getConfigEntry(key: String): ConfigEntry[_] = {
+ sqlConfEntries.get(key)
+ }
+
+ private[internal] def getConfigEntries(): util.Collection[ConfigEntry[_]] = {
+ sqlConfEntries.values()
+ }
+
+ private[internal] def containsConfigEntry(entry: ConfigEntry[_]): Boolean = {
+ getConfigEntry(entry.key) == entry
+ }
+ private[sql] def containsConfigKey(key: String): Boolean = {
+ sqlConfEntries.containsKey(key)
+ }
Review comment:
Fixed, thank you!
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
##########
@@ -53,28 +54,60 @@ import org.apache.spark.util.Utils
object SQLConf {
- private[sql] val sqlConfEntries =
- new ConcurrentHashMap[String, ConfigEntry[_]]()
+ private[this] val sqlConfEntriesUpdateLock = new Object
- val staticConfKeys: java.util.Set[String] =
- java.util.Collections.synchronizedSet(new java.util.HashSet[String]())
+ @volatile
+ private[this] var sqlConfEntries: util.Map[String, ConfigEntry[_]] = util.Collections.emptyMap()
- private def register(entry: ConfigEntry[_]): Unit = sqlConfEntries.merge(entry.key, entry,
- (existingConfigEntry, newConfigEntry) => {
- require(existingConfigEntry == null,
- s"Duplicate SQLConfigEntry. ${newConfigEntry.key} has been registered")
- newConfigEntry
- }
- )
+ private[this] val staticConfKeysUpdateLock = new Object
Review comment:
Thank you for your review! I think these are two different sets of configs, so using two separate locks should be better.
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] hvanhovell commented on pull request #32865: [WIP][SPARK-35701] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
hvanhovell commented on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-858627334
jenkins ok to test
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #32865: [SPARK-35701] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-858748522
Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/44168/
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] viirya closed pull request #32865: [SPARK-35701][SQL] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
viirya closed pull request #32865:
URL: https://github.com/apache/spark/pull/32865
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #32865: [SPARK-35701][SQL] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-859503461
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #32865: [SPARK-35701] Use copy-on-write semantics for SQLConf registered configurations.
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32865:
URL: https://github.com/apache/spark/pull/32865#issuecomment-858878901
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139640/
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org