You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2024/07/30 03:11:36 UTC

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

This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch branch-2.5
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.5 by this push:
     new 0ef4d13cead HBASE-28753 FNFE may occur when accessing the region.jsp of the replica region (#6123)
0ef4d13cead is described below

commit 0ef4d13cead92e0b036c703d5543c6507a0174c2
Author: lupeng <lu...@qq.com>
AuthorDate: Tue Jul 30 11:11:30 2024 +0800

    HBASE-28753 FNFE may occur when accessing the region.jsp of the replica region (#6123)
    
    Signed-off-by: Duo Zhang <zh...@apache.org>
    Signed-off-by: Pankaj Kumar <pa...@apache.org>
---
 .../hbase-webapps/regionserver/region.jsp          | 28 ++++++++++++++--------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/region.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/region.jsp
index 382783ea4ba..27c9b29c8ba 100644
--- a/hbase-server/src/main/resources/hbase-webapps/regionserver/region.jsp
+++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/region.jsp
@@ -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";
   }
@@ -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>
 
@@ -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>
    <%  }
    }%>