You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by bi...@apache.org on 2019/10/31 09:58:00 UTC
[hbase] branch branch-2 updated: HBASE-23184 The HeapAllocation in
WebUI is not accurate (#730)
This is an automated email from the ASF dual-hosted git repository.
binlijin 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 2666358 HBASE-23184 The HeapAllocation in WebUI is not accurate (#730)
2666358 is described below
commit 26663585de7960aa8cc8106057b04369e7352fd9
Author: chenxu14 <47...@users.noreply.github.com>
AuthorDate: Thu Oct 31 17:53:24 2019 +0800
HBASE-23184 The HeapAllocation in WebUI is not accurate (#730)
Signed-off-by: stack <st...@apache.org>
---
.../main/java/org/apache/hadoop/hbase/io/ByteBuffAllocator.java | 8 ++++++++
.../apache/hadoop/hbase/tmpl/regionserver/ServerMetricsTmpl.jamon | 2 +-
.../hadoop/hbase/regionserver/MetricsRegionServerWrapperImpl.java | 2 +-
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/ByteBuffAllocator.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/ByteBuffAllocator.java
index 901d6be..b5dff1b 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/ByteBuffAllocator.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/ByteBuffAllocator.java
@@ -254,6 +254,14 @@ public class ByteBuffAllocator {
return maxBufCount;
}
+ public static long getHeapAllocationBytes(ByteBuffAllocator... allocators) {
+ long heapAllocBytes = 0;
+ for (ByteBuffAllocator alloc : Sets.newHashSet(allocators)) {
+ heapAllocBytes += alloc.getHeapAllocationBytes();
+ }
+ return heapAllocBytes;
+ }
+
public static double getHeapAllocationRatio(ByteBuffAllocator... allocators) {
double heapDelta = 0.0, poolDelta = 0.0;
long heapAllocBytes, poolAllocBytes;
diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/ServerMetricsTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/ServerMetricsTmpl.jamon
index 17fbe1e..96c7c2a 100644
--- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/ServerMetricsTmpl.jamon
+++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/ServerMetricsTmpl.jamon
@@ -246,7 +246,7 @@ ByteBuffAllocator bbAllocator;
<th>Buffer Size(Bytes)</th>
</tr>
<tr>
- <td><% bbAllocator.getHeapAllocationBytes() %></td>
+ <td><% ByteBuffAllocator.getHeapAllocationBytes(bbAllocator, ByteBuffAllocator.HEAP) %></td>
<td><% bbAllocator.getPoolAllocationBytes() %></td>
<td><% String.format("%.3f", ByteBuffAllocator.getHeapAllocationRatio(bbAllocator, ByteBuffAllocator.HEAP) * 100) %><% "%" %></td>
<td><% bbAllocator.getTotalBufferCount() %></td>
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperImpl.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperImpl.java
index 78d7cff..a71429b 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperImpl.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperImpl.java
@@ -993,7 +993,7 @@ class MetricsRegionServerWrapperImpl
@Override
public long getByteBuffAllocatorHeapAllocationBytes() {
- return this.allocator.getHeapAllocationBytes();
+ return ByteBuffAllocator.getHeapAllocationBytes(allocator, ByteBuffAllocator.HEAP);
}
@Override