wchevreuil commented on code in PR #5615:
URL: https://github.com/apache/hbase/pull/5615#discussion_r1461882206


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java:
##########
@@ -386,6 +399,17 @@ public boolean shouldReadBlockFromCache(BlockType 
blockType) {
     return false;
   }
 
+  /**
+   * Checks if the current heap usage is below the threshold configured by
+   * "hbase.rs.prefetchheapusage" (0.8 by default).
+   */
+  public boolean isHeapUsageBelowThreshold() {
+    double total = Runtime.getRuntime().maxMemory();
+    double available = Runtime.getRuntime().freeMemory();
+    double usedRatio = 1d - (available / total);
+    return heapUsageThreshold > usedRatio;

Review Comment:
   It doesn't seem to get accurate values, specially when running in the UTs.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to