DaveDeCaprio commented on a change in pull request #23539: [SPARK-26617][SQL]
Cache manager locks
URL: https://github.com/apache/spark/pull/23539#discussion_r249932591
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/CacheManager.scala
##########
@@ -136,19 +135,21 @@ class CacheManager extends Logging {
spark: SparkSession,
plan: LogicalPlan,
cascade: Boolean,
- blocking: Boolean): Unit = writeLock {
- val shouldRemove: LogicalPlan => Boolean =
- if (cascade) {
- _.find(_.sameResult(plan)).isDefined
- } else {
- _.sameResult(plan)
- }
- val it = cachedData.iterator()
- while (it.hasNext) {
- val cd = it.next()
- if (shouldRemove(cd.plan)) {
- cd.cachedRepresentation.cacheBuilder.clearCache(blocking)
- it.remove()
+ blocking: Boolean): Unit = {
+ writeLock {
+ val shouldRemove: LogicalPlan => Boolean =
+ if (cascade) {
+ _.find(_.sameResult(plan)).isDefined
+ } else {
+ _.sameResult(plan)
+ }
+ val it = cachedData.iterator()
+ while (it.hasNext) {
+ val cd = it.next()
+ if (shouldRemove(cd.plan)) {
+ cd.cachedRepresentation.cacheBuilder.clearCache(blocking)
Review comment:
Ok, in the new implementation clearCache is called after the remove, and
outside of a lock.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]