This is an automated email from the ASF dual-hosted git repository.

vjasani pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 438b5912d16 HBASE-28011 : The logStats about LruBlockCache is not 
accurate (#5344)
438b5912d16 is described below

commit 438b5912d161b7871f3538391c6db1128d819c39
Author: guluo <lupeng_n...@qq.com>
AuthorDate: Thu Aug 10 01:49:39 2023 +0800

    HBASE-28011 : The logStats about LruBlockCache is not accurate (#5344)
---
 .../org/apache/hadoop/hbase/io/hfile/LruBlockCache.java     | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
index 0c63d8d9266..b61084f7883 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
@@ -1015,12 +1015,13 @@ public class LruBlockCache implements 
FirstLevelBlockCache {
 
   public void logStats() {
     // Log size
-    long totalSize = heapSize();
-    long freeSize = maxSize - totalSize;
-    LruBlockCache.LOG.info("totalSize=" + StringUtils.byteDesc(totalSize) + ", 
" + "freeSize="
-      + StringUtils.byteDesc(freeSize) + ", " + "max=" + 
StringUtils.byteDesc(this.maxSize) + ", "
-      + "blockCount=" + getBlockCount() + ", " + "accesses=" + 
stats.getRequestCount() + ", "
-      + "hits=" + stats.getHitCount() + ", " + "hitRatio="
+    long usedSize = heapSize();
+    long freeSize = maxSize - usedSize;
+    LruBlockCache.LOG.info("totalSize=" + StringUtils.byteDesc(maxSize) + ", " 
+ "usedSize="
+      + StringUtils.byteDesc(usedSize) + ", " + "freeSize=" + 
StringUtils.byteDesc(freeSize) + ", "
+      + "max=" + StringUtils.byteDesc(this.maxSize) + ", " + "blockCount=" + 
getBlockCount() + ", "
+      + "accesses=" + stats.getRequestCount() + ", " + "hits=" + 
stats.getHitCount() + ", "
+      + "hitRatio="
       + (stats.getHitCount() == 0
         ? "0"
         : (StringUtils.formatPercent(stats.getHitRatio(), 2) + ", "))

Reply via email to