HBASE-18789 Displays the reporting interval of each RS on the Master page Signed-off-by: tedyu <yuzhih...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/93f5624c Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/93f5624c Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/93f5624c Branch: refs/heads/HBASE-18467 Commit: 93f5624cb9f9d2f8f8d27259ac1d6f44bd99116f Parents: e6e52cd Author: Guangxu Cheng <guangxuch...@gmail.com> Authored: Mon Sep 11 23:36:32 2017 +0800 Committer: tedyu <yuzhih...@gmail.com> Committed: Wed Sep 13 05:51:18 2017 -0700 ---------------------------------------------------------------------- .../src/main/java/org/apache/hadoop/hbase/ServerLoad.java | 7 ++++++- .../hadoop/hbase/tmpl/master/RegionServerListTmpl.jamon | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/93f5624c/hbase-client/src/main/java/org/apache/hadoop/hbase/ServerLoad.java ---------------------------------------------------------------------- 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 0b81660..89302f6 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; + } } http://git-wip-us.apache.org/repos/asf/hbase/blob/93f5624c/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/RegionServerListTmpl.jamon ---------------------------------------------------------------------- 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 5dd10e8..aa6e877 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); <tr> <th>ServerName</th> <th>Start time</th> + <th>Last contact</th> <th>Version</th> <th>Requests Per Second</th> <th>Num. Regions</th> @@ -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(); </%java> <tr> <td><& serverNameLink; serverName=serverName; serverLoad = sl; &></td> <td><% new Date(startcode) %></td> + <td><% TraditionalBinaryPrefix.long2String(lastContact, "s", 1) %></td> <td><% version %></td> <td><% String.format("%.0f", requestsPerSecond) %></td> <td><% numRegionsOnline %></td> @@ -118,6 +122,7 @@ Arrays.sort(serverNames); </%java> <tr><td>Total:<% servers.size() %></td> <td></td> +<td></td> <%if inconsistentNodeNum > 0%> <td style="color:red;"><% inconsistentNodeNum %> nodes with inconsistent version</td> <%else>