|
21 | 21 | import="java.util.Collection" |
22 | 22 | import="java.util.Date" |
23 | 23 | import="java.util.List" |
| 24 | + import="org.apache.hadoop.fs.FileSystem" |
| 25 | + import="org.apache.hadoop.hbase.client.RegionInfo" |
24 | 26 | import="org.apache.hadoop.hbase.client.RegionInfoDisplay" |
25 | 27 | import="org.apache.hadoop.hbase.regionserver.HRegionServer" |
26 | 28 | import="org.apache.hadoop.hbase.regionserver.HStoreFile" |
27 | | - import="org.apache.hadoop.hbase.regionserver.Region" |
28 | | - import="org.apache.hadoop.hbase.regionserver.Store" |
29 | | - import="org.apache.hadoop.hbase.regionserver.StoreFile" |
| 29 | + import="org.apache.hadoop.hbase.regionserver.HRegion" |
| 30 | + import="org.apache.hadoop.hbase.regionserver.HStore" |
30 | 31 | %> |
31 | 32 | <% |
32 | 33 | String regionName = request.getParameter("name"); |
33 | 34 | HRegionServer rs = (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); |
| 35 | + FileSystem fs = rs.getFileSystem(); |
34 | 36 |
|
35 | | - Region region = rs.getRegion(regionName); |
| 37 | + HRegion region = rs.getRegion(regionName); |
36 | 38 | String displayName; |
| 39 | + boolean isReplicaRegion = false; |
37 | 40 | if (region != null) { |
38 | 41 | displayName = RegionInfoDisplay.getRegionNameAsStringForDisplay(region.getRegionInfo(), |
39 | 42 | rs.getConfiguration()); |
| 43 | + isReplicaRegion = region.getRegionInfo().getReplicaId() > RegionInfo.DEFAULT_REPLICA_ID; |
40 | 44 | } else { |
41 | 45 | displayName = "region {" + regionName + "} is not currently online on this region server"; |
42 | 46 | } |
|
54 | 58 | </div> |
55 | 59 |
|
56 | 60 | <% if(region != null) { // |
57 | | - List<? extends Store> stores = region.getStores(); |
58 | | - for (Store store : stores) { |
| 61 | + List<HStore> stores = region.getStores(); |
| 62 | + for (HStore store : stores) { |
59 | 63 | String cf = store.getColumnFamilyName(); |
60 | | - Collection<? extends StoreFile> storeFiles = store.getStorefiles(); %> |
| 64 | + Collection<HStoreFile> storeFiles = store.getStorefiles(); %> |
61 | 65 |
|
62 | 66 | <h3>Column Family: <%= cf %></h3> |
63 | 67 |
|
|
73 | 77 | <th>Len Of Biggest Cell</th> |
74 | 78 | <th>Key Of Biggest Cell</th> |
75 | 79 | </tr> |
76 | | - <% for(StoreFile sf : storeFiles) { %> |
| 80 | + <% int count = 0; |
| 81 | + for(HStoreFile sf : storeFiles) { |
| 82 | + if (isReplicaRegion && !fs.exists(sf.getPath())) continue; |
| 83 | + count++; %> |
77 | 84 | <tr> |
78 | 85 | <td><a href="storeFile.jsp?name=<%= sf.getEncodedPath() %>"><%= sf.getPath() %></a></td> |
79 | | - <td><%= (int) (rs.getFileSystem().getLength(sf.getPath()) / 1024 / 1024) %></td> |
| 86 | + <td><%= (int) (fs.getLength(sf.getPath()) / 1024 / 1024) %></td> |
80 | 87 | <td><%= new Date(sf.getModificationTimestamp()) %></td> |
81 | | - <td><%= String.format("%,1d", ((HStoreFile)sf).getFileInfo().getHFileInfo().getLenOfBiggestCell()) %></td> |
82 | | - <td><%= ((HStoreFile)sf).getFileInfo().getHFileInfo().getKeyOfBiggestCell() %></td> |
| 88 | + <td><%= String.format("%,1d", sf.getFileInfo().getHFileInfo().getLenOfBiggestCell()) %></td> |
| 89 | + <td><%= sf.getFileInfo().getHFileInfo().getKeyOfBiggestCell() %></td> |
83 | 90 | </tr> |
84 | 91 | <% } %> |
85 | 92 |
|
86 | | - <p> <%= storeFiles.size() %> StoreFile(s) in set.</p> |
| 93 | + <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> |
87 | 94 | </table> |
88 | 95 | <% } |
89 | 96 | }%> |
|
0 commit comments