Skip to content

HBASE-28753 FNFE may occur when accessing the region.jsp of the replica region #6117

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 2 commits into from
Jul 27, 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 @@ -22,27 +22,31 @@
import="java.util.Collection"
import="java.util.Date"
import="java.util.List"
import="org.apache.hadoop.fs.FileSystem"
import="org.apache.hadoop.fs.FileStatus"
import="org.apache.hadoop.fs.Path"
import="org.apache.hadoop.hbase.HConstants"
import="org.apache.hadoop.hbase.client.RegionInfo"
import="org.apache.hadoop.hbase.client.RegionInfoDisplay"
import="org.apache.hadoop.hbase.mob.MobUtils"
import="org.apache.hadoop.hbase.regionserver.HRegionServer"
import="org.apache.hadoop.hbase.regionserver.HMobStore"
import="org.apache.hadoop.hbase.regionserver.HStoreFile"
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.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 @@ -59,11 +63,11 @@
</div>
</div>

<% if(region != null) { //
List<? extends Store> stores = region.getStores();
for (Store store : stores) {
<% if(region != null) {
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 @@ -79,17 +83,20 @@
<th>Len Of Biggest Cell</th>
<th>Key Of Biggest Cell</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>
<td><%= String.format("%,1d", ((HStoreFile)sf).getFileInfo().getHFileInfo().getLenOfBiggestCell()) %></td>
<td><%= ((HStoreFile)sf).getFileInfo().getHFileInfo().getKeyOfBiggestCell() %></td>
<td><%= String.format("%,1d", sf.getFileInfo().getHFileInfo().getLenOfBiggestCell()) %></td>
<td><%= sf.getFileInfo().getHFileInfo().getKeyOfBiggestCell() %></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>

<% if (store instanceof HMobStore) { %>
Expand All @@ -103,17 +110,18 @@

<%
int mobCnt = 0;
for (StoreFile sf : storeFiles) {
for (HStoreFile sf : storeFiles) {
try {
byte[] value = ((HStoreFile)sf).getMetadataValue(HStoreFile.MOB_FILE_REFS);
byte[] value = sf.getMetadataValue(HStoreFile.MOB_FILE_REFS);
if (value == null) {
continue;
}

Collection<String> fileNames = MobUtils.deserializeMobFileRefs(value).build().values();
mobCnt += fileNames.size();
for (String fileName : fileNames) {
Path mobPath = new Path(((HMobStore) store).getPath(), fileName);
if (isReplicaRegion && !fs.exists(mobPath)) continue;
mobCnt ++;
FileStatus status = rs.getFileSystem().getFileStatus(mobPath);
String mobPathStr = mobPath.toString();
String encodedStr = URLEncoder.encode(mobPathStr, HConstants.UTF8_ENCODING); %>
Expand All @@ -132,7 +140,7 @@
<% }
} %>

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