You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by vj...@apache.org on 2021/05/25 07:12:37 UTC

[hbase] branch branch-2.4 updated: HBASE-25906 UI of master-status to show recent history of balancer desicion (#3303) (#3296)

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

vjasani pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.4 by this push:
     new 4e079ac  HBASE-25906 UI of master-status to show recent history of balancer desicion (#3303) (#3296)
4e079ac is described below

commit 4e079ace58ec7140165a5ddf848c19b6131e6aff
Author: GeorryHuang <21...@qq.com>
AuthorDate: Tue May 25 15:09:47 2021 +0800

    HBASE-25906 UI of master-status to show recent history of balancer desicion (#3303) (#3296)
    
    Signed-off-by: Duo Zhang <zh...@apache.org>
    Signed-off-by: Viraj Jasani <vj...@apache.org>
---
 .../hbase-webapps/master/namedQueueLog.jsp         | 43 +++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)

diff --git a/hbase-server/src/main/resources/hbase-webapps/master/namedQueueLog.jsp b/hbase-server/src/main/resources/hbase-webapps/master/namedQueueLog.jsp
index c0145d8..dc1e599 100644
--- a/hbase-server/src/main/resources/hbase-webapps/master/namedQueueLog.jsp
+++ b/hbase-server/src/main/resources/hbase-webapps/master/namedQueueLog.jsp
@@ -31,16 +31,18 @@
   import="org.apache.hadoop.hbase.client.ServerType"
   import="org.apache.hadoop.hbase.client.LogEntry"
   import="org.apache.hadoop.hbase.client.BalancerRejection"
+  import="org.apache.hadoop.hbase.client.BalancerDecision"
 %>
 <%
   HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER);
   Configuration conf = master.getConfiguration();
 
   List<BalancerRejection> logList = null;
-
+  List<BalancerDecision> decisionList = null;
   if(master.isInitialized()) {
     try (Admin admin = master.getConnection().getAdmin()) {
       logList = (List<BalancerRejection>)(List<?>)admin.getLogEntries(null, "BALANCER_REJECTION", ServerType.MASTER, 250, null);
+      decisionList = (List<BalancerDecision>)(List<?>)admin.getLogEntries(null, "BALANCER_DECISION", ServerType.MASTER, 250, null);
     }
   }
 %>
@@ -61,6 +63,9 @@
     <li class="active">
       <a href="#tab_named_queue1" data-toggle="tab"> Balancer Rejection </a>
     </li>
+    <li class="">
+          <a href="#tab_named_queue2" data-toggle="tab"> Balancer Decision </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">
@@ -89,6 +94,42 @@
           <% } %>
           </table>
       </div>
+      <div class="tab-pane" id="tab_named_queue2">
+          <table class="table table-striped">
+            <tr>
+              <th>Initial Function Costs</th>
+              <th>Final Function Costs</th>
+              <th>Init Total Cost</th>
+              <th>Computed Total Cost</th>
+              <th>Computed Steps</th>
+              <th>Region Plans</th>
+            </tr>
+            <% if (decisionList == null) { %>
+            <% } else { %>
+              <% for (BalancerDecision decision: decisionList) {  %>
+                <tr>
+                  <td><%=decision.getInitialFunctionCosts()%></td>
+                  <td><%=decision.getFinalFunctionCosts()%></td>
+                  <td><%=StringUtils.format("%.2f", decision.getInitTotalCost())%></td>
+                  <td><%=StringUtils.format("%.2f", decision.getComputedTotalCost())%></td>
+                  <td><%=decision.getComputedSteps()%></td>
+                  <%
+                  List<String> regionPlans = decision.getRegionPlans();
+                  if ( regionPlans == null) {%>
+                    <td></td>
+                  <% }  else { %>
+                    <td>
+                    <table>
+                    <% for (String plan : regionPlans) { %>
+                      <tr><td><%=plan%></td></tr>
+                    <% } %>
+                    </table>
+                    </td>
+                  <% } %>
+                </tr>
+              <% } %>
+            <% } %>
+        </div>
       </div>
   </div>
 </div>