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