Github user ericl commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16135#discussion_r91828396
  
    --- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/PartitionedTablePerfStatsSuite.scala
 ---
    @@ -352,4 +353,28 @@ class PartitionedTablePerfStatsSuite
           }
         }
       }
    +
    +  test("SPARK-18700: add lock for each table's realation in cache") {
    +    withTable("test") {
    +      withTempDir { dir =>
    +        HiveCatalogMetrics.reset()
    +        setupPartitionedHiveTable("test", dir)
    +        // select the table in multi-threads
    +        val executorPool = Executors.newFixedThreadPool(10)
    +        (1 to 10).map(threadId => {
    +          val runnable = new Runnable {
    +            override def run(): Unit = {
    +              spark.sql("select * from test where partCol1 = 999").count()
    +            }
    +          }
    +          executorPool.execute(runnable)
    +          None
    +        })
    +        executorPool.shutdown()
    +        executorPool.awaitTermination(30, TimeUnit.SECONDS)
    +        // check the cache hit, the cache only load once
    +        
assert(HiveCatalogMetrics.METRIC_DATASOUCE_TABLE_CACHE_HITS.getCount() == 9)
    --- End diff --
    
    Does this test fail without the lock?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to