Skip to content

Commit c26f2c4

Browse files
guluo2016virajjasani
authored andcommitted
HBASE-28011 : The logStats about LruBlockCache is not accurate (apache#5344)
1 parent 55df2ca commit c26f2c4

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -960,12 +960,13 @@ public void run() {
960960

961961
public void logStats() {
962962
// Log size
963-
long totalSize = heapSize();
964-
long freeSize = maxSize - totalSize;
965-
LruBlockCache.LOG.info("totalSize=" + StringUtils.byteDesc(totalSize) + ", " + "freeSize="
966-
+ StringUtils.byteDesc(freeSize) + ", " + "max=" + StringUtils.byteDesc(this.maxSize) + ", "
967-
+ "blockCount=" + getBlockCount() + ", " + "accesses=" + stats.getRequestCount() + ", "
968-
+ "hits=" + stats.getHitCount() + ", " + "hitRatio="
963+
long usedSize = heapSize();
964+
long freeSize = maxSize - usedSize;
965+
LruBlockCache.LOG.info("totalSize=" + StringUtils.byteDesc(maxSize) + ", " + "usedSize="
966+
+ StringUtils.byteDesc(usedSize) + ", " + "freeSize=" + StringUtils.byteDesc(freeSize) + ", "
967+
+ "max=" + StringUtils.byteDesc(this.maxSize) + ", " + "blockCount=" + getBlockCount() + ", "
968+
+ "accesses=" + stats.getRequestCount() + ", " + "hits=" + stats.getHitCount() + ", "
969+
+ "hitRatio="
969970
+ (stats.getHitCount() == 0
970971
? "0"
971972
: (StringUtils.formatPercent(stats.getHitRatio(), 2) + ", "))

0 commit comments

Comments
 (0)