Skip to content

HBASE-28753 FNFE may occur when accessing the region.jsp of the replica region (branch-2.5) #6123

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

Merged
merged 1 commit into from
Jul 30, 2024
Merged
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 @@ -21,21 +21,26 @@
import="java.util.Collection"
import="java.util.Date"
import="java.util.List"
import="org.apache.hadoop.fs.FileSystem"
import="org.apache.hadoop.hbase.client.RegionInfo"
import="org.apache.hadoop.hbase.client.RegionInfoDisplay"
import="org.apache.hadoop.hbase.regionserver.HRegionServer"
import="org.apache.hadoop.hbase.regionserver.Region"
import="org.apache.hadoop.hbase.regionserver.Store"
import="org.apache.hadoop.hbase.regionserver.StoreFile"
import="org.apache.hadoop.hbase.regionserver.HStoreFile"
import="org.apache.hadoop.hbase.regionserver.HRegion"
import="org.apache.hadoop.hbase.regionserver.HStore"
%>
<%
String regionName = request.getParameter("name");
HRegionServer rs = (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER);
FileSystem fs = rs.getFileSystem();

Region region = rs.getRegion(regionName);
HRegion 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";
}
Expand All @@ -53,10 +58,10 @@
</div>

<% if(region != null) { //
List<? extends Store> stores = region.getStores();
for (Store store : stores) {
List<HStore> stores = region.getStores();
for (HStore store : stores) {
String cf = store.getColumnFamilyName();
Collection<? extends StoreFile> storeFiles = store.getStorefiles(); %>
Collection<HStoreFile> storeFiles = store.getStorefiles(); %>

<h3>Column Family: <%= cf %></h3>

Expand All @@ -70,15 +75,18 @@
<th>Size (MB)</th>
<th>Modification time</th>
</tr>
<% for(StoreFile sf : storeFiles) { %>
<% int count = 0;
for(HStoreFile sf : storeFiles) {
if (isReplicaRegion && !fs.exists(sf.getPath())) continue;
count++; %>
<tr>
<td><a href="storeFile.jsp?name=<%= sf.getEncodedPath() %>"><%= sf.getPath() %></a></td>
<td><%= (int) (rs.getFileSystem().getLength(sf.getPath()) / 1024 / 1024) %></td>
<td><%= (int) (fs.getLength(sf.getPath()) / 1024 / 1024) %></td>
<td><%= new Date(sf.getModificationTimestamp()) %></td>
</tr>
<% } %>

<p> <%= storeFiles.size() %> StoreFile(s) in set.</p>
<p> <%= count %> StoreFile(s) in set. <%= isReplicaRegion ? "The information about storefile(s) may not up-to-date because it's not the primary region." : "" %></p>
</table>
<% }
}%>
Expand Down