You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "hfutatzhanghb (via GitHub)" <gi...@apache.org> on 2023/02/02 03:11:03 UTC

[GitHub] [hadoop] hfutatzhanghb commented on a diff in pull request #5276: HDFS-16882. RBF: Add cache hit rate metric in MountTableResolver#getDestinationForPath

hfutatzhanghb commented on code in PR #5276:
URL: https://github.com/apache/hadoop/pull/5276#discussion_r1093968053


##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/MountTableResolver.java:
##########
@@ -441,9 +448,12 @@ public PathLocation getDestinationForPath(final String path)
       if (this.locationCache == null) {
         res = lookupLocation(processTrashPath(path));
       } else {
-        Callable<? extends PathLocation> meh = (Callable<PathLocation>) () ->
-            lookupLocation(processTrashPath(path));
+        Callable<? extends PathLocation> meh = (Callable<PathLocation>) () -> {
+          LOC_CACHE_MISS.increment();
+          return lookupLocation(processTrashPath(path));
+        };
         res = this.locationCache.get(processTrashPath(path), meh);
+        LOC_CACHE_ACCESS.increment();

Review Comment:
   hi, @goiri @tomscut , sorry for responding so late.  i have add an unit test to test the cache access.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org