All Downloads are FREE. Search and download functionalities are using the official Maven repository.

hbase-webapps.master.procedures.jsp Maven / Gradle / Ivy

There is a newer version: 3.0.0-beta-1
Show newest version
<%--
/**
 * 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="static org.apache.commons.lang3.StringEscapeUtils.escapeXml"
  import="java.util.Collections"
  import="java.util.Comparator"
  import="java.util.ArrayList"
  import="java.util.Date"
  import="java.util.List"
  import="java.util.Set"
  import="org.apache.hadoop.hbase.master.HMaster"
  import="org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv"
  import="org.apache.hadoop.hbase.procedure2.LockedResource"
  import="org.apache.hadoop.hbase.procedure2.Procedure"
  import="org.apache.hadoop.hbase.procedure2.ProcedureExecutor"
  import="org.apache.hadoop.hbase.procedure2.util.StringUtils"
  import="org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix"
%>
<%@ page import="org.apache.hadoop.hbase.master.procedure.ServerCrashProcedure" %>
<%@ page import="org.apache.hadoop.hbase.master.assignment.TransitRegionStateProcedure" %>
<%@ page import="org.apache.hadoop.hbase.master.assignment.OpenRegionProcedure" %>
<%@ page import="org.apache.hadoop.hbase.master.assignment.CloseRegionProcedure" %>
<%@ page import="org.apache.hadoop.hbase.metrics.OperationMetrics" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="org.apache.hadoop.hbase.master.MetricsAssignmentManagerSource" %>
<%@ page import="org.apache.hadoop.hbase.master.MetricsAssignmentManager" %>
<%@ page import="org.apache.hadoop.hbase.procedure2.ProcedureMetrics" %>
<%@ page import="org.apache.hadoop.hbase.metrics.Snapshot" %>
<%@ page import="org.apache.hadoop.hbase.metrics.Histogram" %>
<%@ page import="java.util.TreeMap" %>
<%@ page import="org.apache.hadoop.hbase.metrics.impl.HistogramImpl" %>
<%
  HMaster master = (HMaster) getServletContext().getAttribute(HMaster.MASTER);
  ProcedureExecutor procExecutor = master.getMasterProcedureExecutor();
  List> procedures = procExecutor.getProcedures();
  Collections.sort(procedures, new Comparator() {
    @Override
    public int compare(Procedure lhs, Procedure rhs) {
      long cmp = lhs.getParentProcId() - rhs.getParentProcId();
      cmp = cmp != 0 ? cmp : lhs.getProcId() - rhs.getProcId();
      return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;
    }
  });

  List lockedResources = master.getLocks();
  pageContext.setAttribute("pageTitle", "HBase Master Procedures: " + master.getServerName());
%>

    


We list proceduces completed successfully of the following types only: ServerCrashProcedure, TransitRegionStateProcedure, OpenRegionProcedure, CloseRegionProcedure.

<% Map latencyMetrics = new TreeMap<>(); MetricsAssignmentManager metricsAssignmentManagerSource = procExecutor.getEnvironment().getAssignmentManager().getAssignmentManagerMetrics(); latencyMetrics.put("OpenRegionProcedure", metricsAssignmentManagerSource.getOpenProcMetrics()); latencyMetrics.put("CloseRegionProcedure", metricsAssignmentManagerSource.getCloseProcMetrics()); latencyMetrics.put("TransitionRegionProcedure#assignRegion", metricsAssignmentManagerSource.getAssignProcMetrics()); latencyMetrics.put("TransitionRegionProcedure#unassignRegion", metricsAssignmentManagerSource.getUnassignProcMetrics()); latencyMetrics.put("TransitionRegionProcedure#moveRegion", metricsAssignmentManagerSource.getMoveProcMetrics()); latencyMetrics.put("TransitionRegionProcedure#reopenRegion", metricsAssignmentManagerSource.getReopenProcMetrics()); latencyMetrics.put("ServerCrashProcedure", master.getMasterMetrics().getServerCrashProcMetrics()); double[] percentiles = new double[] { 0.5, 0.9}; for (Map.Entry e : latencyMetrics.entrySet()) { Histogram histogram = e.getValue().getTimeHisto(); if (histogram.getCount() == 0 || !(histogram instanceof HistogramImpl)) { continue; } HistogramImpl histogramImpl = (HistogramImpl)histogram; long[] percentileLatencies = histogramImpl.getQuantiles(percentiles); %> <% } %>
Type min(ms) 50-percentile(ms) 90-percentile(ms) max(ms)
<%= e.getKey() %> <%= histogramImpl.getMin() %> <%= percentileLatencies[0] %> <%= percentileLatencies[1] %> <%= histogramImpl.getMax() %>

We do not list procedures that have completed successfully; their number makes it hard to spot the problematics.

<% int displayCount = 0; for (Procedure proc : procedures) { // Don't show SUCCESS procedures. if (proc.isSuccess()) { continue; } displayCount++; %> <% } %> <% if (displayCount > 0) { %>

<%= displayCount %> procedure(s).

<% } %>
Id Parent State Owner Type Start Time Last Update Errors Parameters
<%= proc.getProcId() %> <%= proc.hasParent() ? proc.getParentProcId() : "" %> <%= escapeXml(proc.getState().toString() + (proc.isBypass() ? "(Bypass)" : "")) %> <%= proc.hasOwner() ? escapeXml(proc.getOwner()) : "" %> <%= escapeXml(proc.getProcName()) %> <%= new Date(proc.getSubmittedTime()) %> <%= new Date(proc.getLastUpdate()) %> <%= escapeXml(proc.isFailed() ? proc.getException().unwrapRemoteIOException().getMessage() : "") %> <%= escapeXml(proc.toString()) %>

<% if (lockedResources.size() > 0) { %>

<%= lockedResources.size() %> lock(s).

<% } %> <% for (LockedResource lockedResource : lockedResources) { %>

<%= lockedResource.getResourceType() %>: <%= lockedResource.getResourceName() %>

<% switch (lockedResource.getLockType()) { case EXCLUSIVE: %>

Lock type: EXCLUSIVE

Owner procedure: <%= escapeXml(lockedResource.getExclusiveLockOwnerProcedure().toStringDetails()) %>

<% break; case SHARED: %>

Lock type: SHARED

Number of shared locks: <%= lockedResource.getSharedLockCount() %>

<% break; } List> waitingProcedures = lockedResource.getWaitingProcedures(); if (!waitingProcedures.isEmpty()) { %>

Waiting procedures

<% for (Procedure proc : procedures) { %> <% } %>
<%= escapeXml(proc.toStringDetails()) %>
<% } %> <% } %>





© 2015 - 2024 Weber Informatics LLC | Privacy Policy