<%--
/**
 * 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="org.apache.hadoop.hbase.master.HMaster"
         import="org.apache.hadoop.hbase.master.ServerManager"
         import="org.apache.hadoop.hbase.util.JvmVersion"
         import="org.apache.hadoop.hbase.client.MasterSwitchType" %>

<%
  HMaster master = (HMaster) getServletContext().getAttribute(HMaster.MASTER);

  boolean catalogJanitorEnabled = master.isCatalogJanitorEnabled();
  ServerManager serverManager = master.getServerManager();
%>

<!-- Various warnings that cluster admins should be aware of -->
<% if(JvmVersion.isBadJvmVersion()) { %>
<div class="alert alert-danger" role="alert">
  Your current JVM version <%= System.getProperty("java.version") %> is known to be
  unstable with HBase. Please see the
  <a href="https://hbase.apache.org/docs/troubleshooting#jvm-garbage-collection-logs">
    JVM Garbage Collection Logs section of HBase Reference Guide</a>
  for details.
</div>
<% } %>
<% if(master.isInitialized() && !catalogJanitorEnabled) { %>
<div class="alert alert-danger" role="alert">
  Please note that your cluster is running with the CatalogJanitor disabled. It can be
  re-enabled from the hbase shell by running the command 'catalogjanitor_switch true'
</div>
<% } %>
<% if(master.isInMaintenanceMode()) { %>
<div class="alert alert-warning" role="alert">
  Your Master is in maintenance mode. This is because hbase.master.maintenance_mode is
  set to true. Under the maintenance mode, no quota or no Master coprocessor is loaded.
</div>
<% } %>
<% if(!master.isBalancerOn()) { %>
<div class="alert alert-warning" role="alert">
  The Load Balancer is not enabled which will eventually cause performance degradation
  in HBase as Regions will not be distributed across all RegionServers. The balancer
  is only expected to be disabled during rolling upgrade scenarios.
</div>
<% } %>
<% if(!master.isSplitOrMergeEnabled(MasterSwitchType.SPLIT)) { %>
<div class="alert alert-warning" role="alert">
  Region splits are disabled. This may be the result of HBCK aborting while
  running in repair mode. Manually enable splits from the HBase shell,
  or re-run HBCK in repair mode.
</div>
<% } %>
<% if(!master.isSplitOrMergeEnabled(MasterSwitchType.MERGE)) { %>
<div class="alert alert-warning" role="alert">
  Region merges are disabled. This may be the result of HBCK aborting while
  running in repair mode. Manually enable merges from the HBase shell,
  or re-run HBCK in repair mode.
</div>
<% } %>
<% if(master.getAssignmentManager() != null) { %>
  <jsp:include page="assignmentManagerStatus.jsp"/>
<% } %>
<% if (!master.isInMaintenanceMode() && master.getMasterCoprocessorHost() != null) { %>
  <% if (master.getMasterCoprocessorHost().findCoprocessor("RSGroupAdminEndpoint") != null &&
    serverManager.getOnlineServersList().size() > 0) { %>
      <section>
        <h2><a name="rsgroup">RSGroup</a></h2>
        <jsp:include page="rsGroupList.jsp"/>
      </section>
  <% } %>
<% } %>
