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

    https://github.com/apache/spark/pull/16135#discussion_r91849543
  
    --- Diff: 
core/src/main/scala/org/apache/spark/metrics/source/StaticSources.scala ---
    @@ -97,6 +97,12 @@ object HiveCatalogMetrics extends Source {
         MetricRegistry.name("parallelListingJobCount"))
     
       /**
    +   * Tracks the total number of cachedDataSourceTables hits.
    +   */
    +  val METRIC_DATASOUCE_TABLE_CACHE_HITS = metricRegistry.counter(
    +    MetricRegistry.name("dataSourceTableCacheHits"))
    --- End diff --
    
    May be we can't, only the cache hits can help us check the number.
    I do the test below:
    I add a `Thread.sleep(1000)` before 
`cachedDataSourceTables.put(tableIdentifier, created)` in 
HiveMetastoreCatalog.scala +265 to make the build table relation slow. And 
print all the metrics with and without lock
    ```
    println(HiveCatalogMetrics.METRIC_DATASOUCE_TABLE_CACHE_HITS.getCount())
    println(HiveCatalogMetrics.METRIC_FILE_CACHE_HITS.getCount())
    println(HiveCatalogMetrics.METRIC_FILES_DISCOVERED.getCount())
    println(HiveCatalogMetrics.METRIC_HIVE_CLIENT_CALLS.getCount())
    println(HiveCatalogMetrics.METRIC_PARALLEL_LISTING_JOB_COUNT.getCount())
    println(HiveCatalogMetrics.METRIC_PARTITIONS_FETCHED.getCount())
    ```
    The result of without lock:
    ```
    0
    0
    5
    70
    0
    0
    ```
    and the result of with lock:
    ```
    9
    0
    5
    70
    0
    0
    ```


---
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

Reply via email to