This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/master by this push:
     new 5b99409  HBASE-25791 UI of master-status to show a recent history of 
that why balancer was rejected to run (#3275)
5b99409 is described below

commit 5b9940907e695e20d24968cbc725277a19ce2170
Author: GeorryHuang <215175...@qq.com>
AuthorDate: Wed May 19 12:05:29 2021 +0800

    HBASE-25791 UI of master-status to show a recent history of that why 
balancer was rejected to run (#3275)
    
    Signed-off-by: Duo Zhang <zhang...@apache.org>
---
 .../hbase/tmpl/master/MasterStatusTmpl.jamon       |  1 +
 .../main/resources/hbase-webapps/master/header.jsp |  4 +
 .../hbase-webapps/master/namedQueueLog.jsp         | 95 ++++++++++++++++++++++
 3 files changed, 100 insertions(+)

diff --git 
a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon
 
b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon
index 7310041..3e049cc 100644
--- 
a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon
+++ 
b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon
@@ -153,6 +153,7 @@ AssignmentManager assignmentManager = 
master.getAssignmentManager();
                 <%if master.isActiveMaster() %>
                     <li><a href="/procedures.jsp">Procedures &amp; 
Locks</a></li>
                     <li><a href="/hbck.jsp">HBCK Report</a></li>
+                    <li><a href="/namedQueueLog.jsp">Named Queue Logs</a></li>
                     <%if 
master.getConfiguration().getBoolean(QuotaUtil.QUOTA_CONF_KEY, false) %>
                         <li><a href="/quotas.jsp">Quotas</a></li>
                     </%if>
diff --git a/hbase-server/src/main/resources/hbase-webapps/master/header.jsp 
b/hbase-server/src/main/resources/hbase-webapps/master/header.jsp
index 98efdf0..58d834e 100644
--- a/hbase-server/src/main/resources/hbase-webapps/master/header.jsp
+++ b/hbase-server/src/main/resources/hbase-webapps/master/header.jsp
@@ -21,6 +21,7 @@
     import="org.apache.hadoop.hbase.master.HMaster"
     import="org.apache.hadoop.hbase.quotas.QuotaUtil"
     import="org.apache.hadoop.hbase.HBaseConfiguration"
+    import="org.apache.hadoop.hbase.master.balancer.BaseLoadBalancer"
 %>
 <%
   HMaster master = (HMaster) getServletContext().getAttribute(HMaster.MASTER);
@@ -60,6 +61,9 @@
             <% if (master.isActiveMaster()){ %>
               <li><a href="/procedures.jsp">Procedures &amp; Locks</a></li>
               <li><a href="/hbck.jsp">HBCK Report</a></li>
+              <% if 
(master.getConfiguration().getBoolean(BaseLoadBalancer.BALANCER_REJECTION_BUFFER_ENABLED,
 false)) { %>
+                <li><a href="/namedQueueLog.jsp">Named Queue Logs</a></li>
+              <% }%>
               <% if 
(master.getConfiguration().getBoolean(QuotaUtil.QUOTA_CONF_KEY, false)) { %>
                 <li><a href="/quotas.jsp">Quotas</a></li>
               <% }%>
diff --git 
a/hbase-server/src/main/resources/hbase-webapps/master/namedQueueLog.jsp 
b/hbase-server/src/main/resources/hbase-webapps/master/namedQueueLog.jsp
new file mode 100644
index 0000000..c0145d8
--- /dev/null
+++ b/hbase-server/src/main/resources/hbase-webapps/master/namedQueueLog.jsp
@@ -0,0 +1,95 @@
+<%--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+--%>
+<%@ page contentType="text/html;charset=UTF-8"
+  import="java.util.Date"
+  import="java.util.List"
+  import="org.apache.hadoop.conf.Configuration"
+  import="org.apache.hadoop.hbase.client.Admin"
+  import="org.apache.hadoop.hbase.client.SnapshotDescription"
+  import="org.apache.hadoop.hbase.http.InfoServer"
+  import="org.apache.hadoop.hbase.master.HMaster"
+  import="org.apache.hadoop.hbase.snapshot.SnapshotInfo"
+  import="org.apache.hadoop.util.StringUtils"
+  import="org.apache.hadoop.hbase.TableName"
+  import="org.apache.hadoop.hbase.client.ServerType"
+  import="org.apache.hadoop.hbase.client.LogEntry"
+  import="org.apache.hadoop.hbase.client.BalancerRejection"
+%>
+<%
+  HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER);
+  Configuration conf = master.getConfiguration();
+
+  List<BalancerRejection> logList = null;
+
+  if(master.isInitialized()) {
+    try (Admin admin = master.getConnection().getAdmin()) {
+      logList = (List<BalancerRejection>)(List<?>)admin.getLogEntries(null, 
"BALANCER_REJECTION", ServerType.MASTER, 250, null);
+    }
+  }
+%>
+
+<jsp:include page="header.jsp">
+    <jsp:param name="pageTitle" value="${pageTitle}"/>
+</jsp:include>
+
+
+<div class="container-fluid content">
+  <div class="row">
+    <div class="page-header">
+    <h2>Named Queues</h2>
+    </div>
+    </div>
+<div class="tabbable">
+  <ul class="nav nav-pills">
+    <li class="active">
+      <a href="#tab_named_queue1" data-toggle="tab"> Balancer Rejection </a>
+    </li>
+  </ul>
+    <div class="tab-content" style="padding-bottom: 9px; border-bottom: 1px 
solid #ddd;">
+      <div class="tab-pane active" id="tab_named_queue1">
+        <table class="table table-striped">
+          <tr>
+            <th>Reason</th>
+            <th>CostFunctions Details</th>
+          </tr>
+          <% if (logList == null) { %>
+          <% } else { %>
+            <% for (BalancerRejection entry: logList) {  %>
+              <tr>
+                <td><%=entry.getReason()%></td>
+                <td>
+                <% List<String> costFunctions = entry.getCostFuncInfoList();
+                   if (costFunctions != null && !costFunctions.isEmpty()) { %>
+                  <table>
+                  <% for (String costFunctionInfo: entry.getCostFuncInfoList() 
) { %>
+                    <tr><td><%= costFunctionInfo %></td></tr>
+                  <% }%>
+                  </table>
+                  <% } %>
+                </td>
+              </tr>
+            <% } %>
+          <% } %>
+          </table>
+      </div>
+      </div>
+  </div>
+</div>
+<jsp:include page="footer.jsp" />

Reply via email to