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

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


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

commit c26f2c432272969577fc34749ae3de1e44ba5e73
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 74514aa4a55..44592da5daf 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
@@ -960,12 +960,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