<%-- /** * 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.store.wal.ProcedureWALFile" import="org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore" import="org.apache.hadoop.hbase.procedure2.util.StringUtils" import="org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix" %> <% HMaster master = (HMaster) getServletContext().getAttribute(HMaster.MASTER); ProcedureExecutor procExecutor = master.getMasterProcedureExecutor(); WALProcedureStore walStore = master.getWalProcedureStore(); ArrayList syncMetricsBuff = walStore.getSyncMetrics(); long millisToNextRoll = walStore.getMillisToNextPeriodicRoll(); long millisFromLastRoll = walStore.getMillisFromLastRoll(); ArrayList procedureWALFiles = walStore.getActiveLogs(); Set corruptedWALFiles = walStore.getCorruptedLogs(); 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 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()) %>
<% } %> <% } %>

<% if (procedureWALFiles != null && procedureWALFiles.size() > 0) { %> <% for (int i = procedureWALFiles.size() - 1; i >= 0; --i) { %> <% ProcedureWALFile pwf = procedureWALFiles.get(i); %> <% } %>
LogID Size Timestamp Path
<%= pwf.getLogId() %> <%= TraditionalBinaryPrefix.long2String(pwf.getSize(), "B", 1) %> <%= new Date(pwf.getTimestamp()) %> <%= escapeXml(pwf.toString()) %>
<% } else {%>

No WAL files

<% } %>
<% if (corruptedWALFiles != null && corruptedWALFiles.size() > 0) { %> <% for (ProcedureWALFile cwf:corruptedWALFiles) { %> <% } %>
LogID Size Timestamp Path
<%= cwf.getLogId() %> <%= TraditionalBinaryPrefix.long2String(cwf.getSize(), "B", 1) %> <%= new Date(cwf.getTimestamp()) %> <%= escapeXml(cwf.toString()) %>
<% } else {%>

No corrupted WAL files

<% } %>
Milliseconds to next roll Milliseconds from last roll
<%=StringUtils.humanTimeDiff(millisToNextRoll) %> <%=StringUtils.humanTimeDiff(millisFromLastRoll) %>
<% for (int i = syncMetricsBuff.size() - 1; i >= 0; --i) { %> <% WALProcedureStore.SyncMetrics syncMetrics = syncMetricsBuff.get(i); %> <%} %>
Time Sync Wait Last num of synced entries Total Synced Synced per second
<%= new Date(syncMetrics.getTimestamp()) %> <%= StringUtils.humanTimeDiff(syncMetrics.getSyncWaitMs()) %> <%= syncMetrics.getSyncedEntries() %> <%= TraditionalBinaryPrefix.long2String(syncMetrics.getTotalSyncedBytes(), "B", 1) %> <%= TraditionalBinaryPrefix.long2String((long)syncMetrics.getSyncedPerSec(), "B", 1) %>