[GitHub] spark pull request #16135: [SPARK-18700][SQL] Add ReadWriteLock for each tab...

2016-12-07 Thread ericl
Github user ericl commented on a diff in the pull request:

https://github.com/apache/spark/pull/16135#discussion_r91455760
  
--- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveSessionCatalog.scala ---
@@ -95,7 +95,7 @@ private[sql] class HiveSessionCatalog(
   }
 
   def invalidateCache(): Unit = {
-metastoreCatalog.cachedDataSourceTables.invalidateAll()
+metastoreCatalog.invalidateAllCache()
--- End diff --

Why this change?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #16135: [SPARK-18700][SQL] Add ReadWriteLock for each tab...

2016-12-07 Thread ericl
Github user ericl commented on a diff in the pull request:

https://github.com/apache/spark/pull/16135#discussion_r91455755
  
--- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveSessionCatalog.scala ---
@@ -105,7 +105,8 @@ private[sql] class HiveSessionCatalog(
   // For testing only
   private[hive] def getCachedDataSourceTable(table: TableIdentifier): 
LogicalPlan = {
 val key = metastoreCatalog.getQualifiedTableName(table)
-metastoreCatalog.cachedDataSourceTables.getIfPresent(key)
+metastoreCatalog.readLock(key,
+  metastoreCatalog.cachedDataSourceTables.getIfPresent(key))
--- End diff --

Why a read lock here?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #16135: [SPARK-18700][SQL] Add ReadWriteLock for each tab...

2016-12-07 Thread ericl
Github user ericl commented on a diff in the pull request:

https://github.com/apache/spark/pull/16135#discussion_r91369430
  
--- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala ---
@@ -53,6 +56,10 @@ private[hive] class HiveMetastoreCatalog(sparkSession: 
SparkSession) extends Log
   tableIdent.table.toLowerCase)
   }
 
+  /** ReadWriteLock for each tables, protect the read and write cached */
+  protected[hive] val tableLockMap =
+new ConcurrentHashMap[QualifiedTableName, ReentrantReadWriteLock]
--- End diff --


https://google.github.io/guava/releases/19.0/api/docs/com/google/common/util/concurrent/Striped.html
 is usually good enough


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org