From 5370aed410e41858aea3199cb613402336e8551f Mon Sep 17 00:00:00 2001 From: Guangxu Cheng Date: Mon, 11 Sep 2017 23:36:32 +0800 Subject: [PATCH] HBASE-18789 Displays the reporting interval of each RS on the Master page Signed-off-by: tedyu --- .../src/main/java/org/apache/hadoop/hbase/ServerLoad.java | 7 ++++++- .../hadoop/hbase/tmpl/master/RegionServerListTmpl.jamon | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerLoad.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerLoad.java index 0b816603101..89302f650eb 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerLoad.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerLoad.java @@ -54,10 +54,12 @@ public class ServerLoad { private int totalStaticBloomSizeKB = 0; private long totalCompactingKVs = 0; private long currentCompactedKVs = 0; + private long reportTime = 0; @InterfaceAudience.Private public ServerLoad(ClusterStatusProtos.ServerLoad serverLoad) { this.serverLoad = serverLoad; + this.reportTime = System.currentTimeMillis(); for (ClusterStatusProtos.RegionLoad rl: serverLoad.getRegionLoadsList()) { stores += rl.getStores(); storefiles += rl.getStorefiles(); @@ -74,7 +76,6 @@ public class ServerLoad { totalCompactingKVs += rl.getTotalCompactingKVs(); currentCompactedKVs += rl.getCurrentCompactedKVs(); } - } // NOTE: Function name cannot start with "get" because then an OpenDataException is thrown because @@ -359,4 +360,8 @@ public class ServerLoad { public static final ServerLoad EMPTY_SERVERLOAD = new ServerLoad(ClusterStatusProtos.ServerLoad.newBuilder().build()); + + public long getReportTime() { + return reportTime; + } } diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/RegionServerListTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/RegionServerListTmpl.jamon index 5dd10e8435e..aa6e877ffb4 100644 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/RegionServerListTmpl.jamon +++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/RegionServerListTmpl.jamon @@ -77,6 +77,7 @@ Arrays.sort(serverNames); ServerName Start time + Last contact Version Requests Per Second Num. Regions @@ -96,6 +97,7 @@ Arrays.sort(serverNames); double requestsPerSecond = 0.0; int numRegionsOnline = 0; + long lastContact = 0; if (sl != null) { requestsPerSecond = sl.getRequestsPerSecond(); @@ -103,12 +105,14 @@ Arrays.sort(serverNames); totalRegions += sl.getNumberOfRegions(); // Is this correct? Adding a rate to a measure. totalRequests += sl.getNumberOfRequests(); + lastContact = (System.currentTimeMillis() - sl.getReportTime())/1000; } long startcode = serverName.getStartcode(); <& serverNameLink; serverName=serverName; serverLoad = sl; &> <% new Date(startcode) %> + <% TraditionalBinaryPrefix.long2String(lastContact, "s", 1) %> <% version %> <% String.format("%.0f", requestsPerSecond) %> <% numRegionsOnline %> @@ -118,6 +122,7 @@ Arrays.sort(serverNames); Total:<% servers.size() %> + <%if inconsistentNodeNum > 0%> <% inconsistentNodeNum %> nodes with inconsistent version <%else>