hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhang...@apache.org
Subject [08/48] hbase git commit: HBASE-17436 Add column to master web UI for displaying region states when listing regions of a table.
Date Sat, 06 Jan 2018 03:35:17 GMT
HBASE-17436 Add column to master web UI for displaying region states when listing regions of
a table.

Signed-off-by: Apekshit Sharma <appy@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/9cd0e1a4
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/9cd0e1a4
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/9cd0e1a4

Branch: refs/heads/HBASE-19397
Commit: 9cd0e1a490e118189289746686ec3aecef987b2a
Parents: 5ce9351
Author: Janos Gub <gubjanos@gmail.com>
Authored: Fri Jan 5 14:30:10 2018 -0800
Committer: Apekshit Sharma <appy@apache.org>
Committed: Fri Jan 5 14:32:27 2018 -0800

----------------------------------------------------------------------
 .../main/resources/hbase-webapps/master/table.jsp | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/9cd0e1a4/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
index 319c7bf..9252552 100644
--- a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
+++ b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
@@ -27,6 +27,7 @@
   import="java.util.LinkedHashMap"
   import="java.util.List"
   import="java.util.Map"
+  import="java.util.HashMap"
   import="java.util.TreeMap"
   import="org.apache.commons.lang3.StringEscapeUtils"
   import="org.apache.hadoop.conf.Configuration"
@@ -46,6 +47,8 @@
   import="org.apache.hadoop.hbase.client.RegionReplicaUtil"
   import="org.apache.hadoop.hbase.client.Table"
   import="org.apache.hadoop.hbase.master.HMaster"
+  import="org.apache.hadoop.hbase.master.assignment.RegionStates"
+  import="org.apache.hadoop.hbase.master.RegionState"
   import="org.apache.hadoop.hbase.quotas.QuotaTableUtil"
   import="org.apache.hadoop.hbase.quotas.SpaceQuotaSnapshot"
   import="org.apache.hadoop.hbase.util.Bytes"
@@ -247,6 +250,14 @@ if ( fqtn != null ) {
 </table>
 <%} else {
   Admin admin = master.getConnection().getAdmin();
+  RegionStates states = master.getAssignmentManager().getRegionStates();
+  Map<RegionState.State, List<RegionInfo>> regionStates = states.getRegionByStateOfTable(table.getName());
+  Map<String, RegionState.State> stateMap = new HashMap<>();
+  for (RegionState.State regionState : regionStates.keySet()) {
+    for (RegionInfo regionInfo : regionStates.get(regionState)) {
+        stateMap.put(regionInfo.getEncodedName(), regionState);
+    }
+  }
   RegionLocator r = master.getClusterConnection().getRegionLocator(table.getName());
   try { %>
 <h2>Table Attributes</h2>
@@ -452,6 +463,7 @@ ShowDetailName&Start/End Key<input type="checkbox" id="showWhole"
style="margin-
 <th>Locality</th>
 <th>Start Key</th>
 <th>End Key</th>
+<th>Region State</th>
 <%
   if (withReplica) {
 %>
@@ -630,6 +642,7 @@ ShowDetailName&Start/End Key<input type="checkbox" id="showWhole"
style="margin-
     String fileCount = "N/A";
     String memSize = "N/A";
     float locality = 0.0f;
+    String state = "N/A";
     if(load != null) {
       readReq = String.format("%,1d", load.getReadRequestsCount());
       writeReq = String.format("%,1d", load.getWriteRequestsCount());
@@ -639,6 +652,10 @@ ShowDetailName&Start/End Key<input type="checkbox" id="showWhole"
style="margin-
       locality = load.getDataLocality();
     }
 
+    if (stateMap.containsKey(regionInfo.getEncodedName())) {
+     state = stateMap.get(regionInfo.getEncodedName()).toString();
+    }
+
     if (addr != null) {
       ServerLoad sl = master.getServerManager().getLoad(addr);
       // This port might be wrong if RS actually ended up using something else.
@@ -681,6 +698,7 @@ ShowDetailName&Start/End Key<input type="checkbox" id="showWhole"
style="margin-
   <td><%= locality%></td>
   <td><%= escapeXml(showWhole?Bytes.toStringBinary(regionInfo.getStartKey()):"-")%></td>
   <td><%= escapeXml(showWhole?Bytes.toStringBinary(regionInfo.getEndKey()):"-")%></td>
+  <td><%= state%></td>
   <%
   if (withReplica) {
   %>


Mime
View raw message