Skip to content

Commit

Permalink
HBASE-25791 UI of master-status to show a recent history of that why …
Browse files Browse the repository at this point in the history
…balancer was rejected to run (#3278)

Signed-off-by: Duo Zhang <[email protected]>
  • Loading branch information
GeorryHuang authored May 20, 2021
1 parent d19e058 commit 3040be1
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<% 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>
<% }%>
Expand Down
Original file line number Diff line number Diff line change
@@ -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" />

0 comments on commit 3040be1

Please sign in to comment.