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 <zhangduo@apache.org>
This commit is contained in:
GeorryHuang 2021-05-19 12:05:29 +08:00 committed by GitHub
parent 741b4b4674
commit 5b9940907e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 100 additions and 0 deletions

View File

@ -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>

View File

@ -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>
<% }%>

View File

@ -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" />