Repository: hbase
Updated Branches:
  refs/heads/branch-1 432ca7e3f -> a8ac84f1a


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/a8ac84f1
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/a8ac84f1
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/a8ac84f1

Branch: refs/heads/branch-1
Commit: a8ac84f1a62c25a7d763edaad323dd3ed90452b4
Parents: 432ca7e
Author: Guangxu Cheng <guangxuch...@gmail.com>
Authored: Wed Sep 13 23:37:19 2017 +0800
Committer: tedyu <yuzhih...@gmail.com>
Committed: Wed Sep 13 09:39:09 2017 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/hadoop/hbase/ServerLoad.java      | 6 ++++++
 .../apache/hadoop/hbase/tmpl/master/RegionServerListTmpl.jamon | 5 +++++
 2 files changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/a8ac84f1/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 3d502c0..ddca47a 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
@@ -55,9 +55,11 @@ public class ServerLoad {
   private int totalStaticBloomSizeKB = 0;
   private long totalCompactingKVs = 0;
   private long currentCompactedKVs = 0;
+  private long reportTime = 0;
 
   public ServerLoad(ClusterStatusProtos.ServerLoad serverLoad) {
     this.serverLoad = serverLoad;
+    this.reportTime = System.currentTimeMillis();
     for (ClusterStatusProtos.RegionLoad rl: serverLoad.getRegionLoadsList()) {
       stores += rl.getStores();
       storefiles += rl.getStorefiles();
@@ -323,4 +325,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/a8ac84f1/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 cde757f..451cfa4 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
@@ -81,6 +81,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>
@@ -100,6 +101,7 @@ Arrays.sort(serverNames);
     
     double requestsPerSecond = 0.0;
     int numRegionsOnline = 0;
+    long lastContact = 0;
 
     if (sl != null) {
         requestsPerSecond = sl.getRequestsPerSecond();
@@ -107,12 +109,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>
@@ -122,6 +126,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>

Reply via email to