spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ericl <...@git.apache.org>
Subject [GitHub] spark pull request #16135: [SPARK-18700][SQL] Add StripedLock for each table...
Date Sun, 11 Dec 2016 07:22:48 GMT
Github user ericl commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16135#discussion_r91849698
  
    --- 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 --
    
    Yeah that's fine, as long as it fails some fraction of the time it will eventually show
up as a flaky test.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


Mime
View raw message