Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HBASE-28778 NPE may occur when opening master-status or table.jsp or procedure.jsp while Master is initializing (branch-2) #6210

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) thro
private ServerName getMetaLocationOrNull(HMaster master) {
RegionStateNode rsn = master.getAssignmentManager().getRegionStates()
.getRegionStateNode(RegionInfoBuilder.FIRST_META_REGIONINFO);
return rsn.isInState(RegionState.State.OPEN) ? rsn.getRegionLocation() : null;
if (rsn != null) {
return rsn.isInState(RegionState.State.OPEN) ? rsn.getRegionLocation() : null;
}
return null;
}

private Map<String, Integer> getFragmentationInfo(HMaster master, Configuration conf)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,28 @@
<%@ page import="org.apache.hadoop.hbase.metrics.Histogram" %>
<%@ page import="java.util.TreeMap" %>
<%@ page import="org.apache.hadoop.hbase.metrics.impl.HistogramImpl" %>

<jsp:include page="header.jsp">
<jsp:param name="pageTitle" value="${pageTitle}"/>
</jsp:include>

<%
HMaster master = (HMaster) getServletContext().getAttribute(HMaster.MASTER);
if (!master.isInitialized()) {
%>
<div class="container-fluid content">
<div class="row inner_header">
<div class="page-header">
<h1>Master is initializing</h1>
</div>
</div>
<p><hr><p>
<jsp:include page="redirect.jsp" />
</div>
<% return;
} %>

<%
ProcedureExecutor<MasterProcedureEnv> procExecutor = master.getMasterProcedureExecutor();
List<Procedure<MasterProcedureEnv>> procedures = procExecutor.getProcedures();
Collections.sort(procedures, new Comparator<Procedure>() {
Expand All @@ -63,9 +83,6 @@
List<LockedResource> lockedResources = master.getLocks();
pageContext.setAttribute("pageTitle", "HBase Master Procedures: " + master.getServerName());
%>
<jsp:include page="header.jsp">
<jsp:param name="pageTitle" value="${pageTitle}"/>
</jsp:include>

<div class="container-fluid content">
<div class="row top_header">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,22 @@
String regionName = request.getParameter("name");
HRegionServer rs = (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER);
FileSystem fs = rs.getFileSystem();

HRegion region = rs.getRegion(regionName);
HRegion region = null;
if (regionName != null) {
region = rs.getRegion(regionName);
}
String displayName;
boolean isReplicaRegion = false;
if (region != null) {
displayName = RegionInfoDisplay.getRegionNameAsStringForDisplay(region.getRegionInfo(),
rs.getConfiguration());
isReplicaRegion = region.getRegionInfo().getReplicaId() > RegionInfo.DEFAULT_REPLICA_ID;
} else {
displayName = "region {" + regionName + "} is not currently online on this region server";
if (regionName != null) {
displayName = "region {" + regionName + "} is not currently online on this region server";
} else {
displayName = "you must specify a region name when accessing this page";
}
}
pageContext.setAttribute("pageTitle", "HBase RegionServer: " + rs.getServerName());
%>
Expand Down