|
22 | 22 | import="java.util.Collection"
|
23 | 23 | import="java.util.Date"
|
24 | 24 | import="java.util.List"
|
| 25 | + import="org.apache.hadoop.fs.FileSystem" |
25 | 26 | import="org.apache.hadoop.fs.FileStatus"
|
26 | 27 | import="org.apache.hadoop.fs.Path"
|
27 | 28 | import="org.apache.hadoop.hbase.HConstants"
|
| 29 | + import="org.apache.hadoop.hbase.client.RegionInfo" |
28 | 30 | import="org.apache.hadoop.hbase.client.RegionInfoDisplay"
|
29 | 31 | import="org.apache.hadoop.hbase.mob.MobUtils"
|
30 | 32 | import="org.apache.hadoop.hbase.regionserver.HRegionServer"
|
31 | 33 | import="org.apache.hadoop.hbase.regionserver.HMobStore"
|
32 | 34 | import="org.apache.hadoop.hbase.regionserver.HStoreFile"
|
33 |
| - import="org.apache.hadoop.hbase.regionserver.Region" |
34 |
| - import="org.apache.hadoop.hbase.regionserver.Store" |
35 |
| - import="org.apache.hadoop.hbase.regionserver.StoreFile" |
| 35 | + import="org.apache.hadoop.hbase.regionserver.HRegion" |
| 36 | + import="org.apache.hadoop.hbase.regionserver.HStore" |
36 | 37 | %>
|
37 | 38 | <%
|
38 | 39 | String regionName = request.getParameter("name");
|
39 | 40 | HRegionServer rs = (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER);
|
| 41 | + FileSystem fs = rs.getFileSystem(); |
40 | 42 |
|
41 |
| - Region region = rs.getRegion(regionName); |
| 43 | + HRegion region = rs.getRegion(regionName); |
42 | 44 | String displayName;
|
| 45 | + boolean isReplicaRegion = false; |
43 | 46 | if (region != null) {
|
44 | 47 | displayName = RegionInfoDisplay.getRegionNameAsStringForDisplay(region.getRegionInfo(),
|
45 | 48 | rs.getConfiguration());
|
| 49 | + isReplicaRegion = region.getRegionInfo().getReplicaId() > RegionInfo.DEFAULT_REPLICA_ID; |
46 | 50 | } else {
|
47 | 51 | displayName = "region {" + regionName + "} is not currently online on this region server";
|
48 | 52 | }
|
|
59 | 63 | </div>
|
60 | 64 | </div>
|
61 | 65 |
|
62 |
| -<% if(region != null) { // |
63 |
| - List<? extends Store> stores = region.getStores(); |
64 |
| - for (Store store : stores) { |
| 66 | +<% if(region != null) { |
| 67 | + List<HStore> stores = region.getStores(); |
| 68 | + for (HStore store : stores) { |
65 | 69 | String cf = store.getColumnFamilyName();
|
66 |
| - Collection<? extends StoreFile> storeFiles = store.getStorefiles(); %> |
| 70 | + Collection<HStoreFile> storeFiles = store.getStorefiles(); %> |
67 | 71 |
|
68 | 72 | <h3>Column Family: <%= cf %></h3>
|
69 | 73 |
|
|
79 | 83 | <th>Len Of Biggest Cell</th>
|
80 | 84 | <th>Key Of Biggest Cell</th>
|
81 | 85 | </tr>
|
82 |
| - <% for(StoreFile sf : storeFiles) { %> |
| 86 | + <% int count = 0; |
| 87 | + for(HStoreFile sf : storeFiles) { |
| 88 | + if (isReplicaRegion && !fs.exists(sf.getPath())) continue; |
| 89 | + count ++; %> |
83 | 90 | <tr>
|
84 | 91 | <td><a href="storeFile.jsp?name=<%= sf.getEncodedPath() %>"><%= sf.getPath() %></a></td>
|
85 |
| - <td><%= (int) (rs.getFileSystem().getLength(sf.getPath()) / 1024 / 1024) %></td> |
| 92 | + <td><%= (int) (fs.getLength(sf.getPath()) / 1024 / 1024) %></td> |
86 | 93 | <td><%= new Date(sf.getModificationTimestamp()) %></td>
|
87 |
| - <td><%= String.format("%,1d", ((HStoreFile)sf).getFileInfo().getHFileInfo().getLenOfBiggestCell()) %></td> |
88 |
| - <td><%= ((HStoreFile)sf).getFileInfo().getHFileInfo().getKeyOfBiggestCell() %></td> |
| 94 | + <td><%= String.format("%,1d", sf.getFileInfo().getHFileInfo().getLenOfBiggestCell()) %></td> |
| 95 | + <td><%= sf.getFileInfo().getHFileInfo().getKeyOfBiggestCell() %></td> |
89 | 96 | </tr>
|
90 | 97 | <% } %>
|
91 | 98 |
|
92 |
| - <p> <%= storeFiles.size() %> StoreFile(s) in set.</p> |
| 99 | + <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> |
93 | 100 | </table>
|
94 | 101 |
|
95 | 102 | <% if (store instanceof HMobStore) { %>
|
|
103 | 110 |
|
104 | 111 | <%
|
105 | 112 | int mobCnt = 0;
|
106 |
| - for (StoreFile sf : storeFiles) { |
| 113 | + for (HStoreFile sf : storeFiles) { |
107 | 114 | try {
|
108 |
| - byte[] value = ((HStoreFile)sf).getMetadataValue(HStoreFile.MOB_FILE_REFS); |
| 115 | + byte[] value = sf.getMetadataValue(HStoreFile.MOB_FILE_REFS); |
109 | 116 | if (value == null) {
|
110 | 117 | continue;
|
111 | 118 | }
|
112 | 119 |
|
113 | 120 | Collection<String> fileNames = MobUtils.deserializeMobFileRefs(value).build().values();
|
114 |
| - mobCnt += fileNames.size(); |
115 | 121 | for (String fileName : fileNames) {
|
116 | 122 | Path mobPath = new Path(((HMobStore) store).getPath(), fileName);
|
| 123 | + if (isReplicaRegion && !fs.exists(mobPath)) continue; |
| 124 | + mobCnt ++; |
117 | 125 | FileStatus status = rs.getFileSystem().getFileStatus(mobPath);
|
118 | 126 | String mobPathStr = mobPath.toString();
|
119 | 127 | String encodedStr = URLEncoder.encode(mobPathStr, HConstants.UTF8_ENCODING); %>
|
|
132 | 140 | <% }
|
133 | 141 | } %>
|
134 | 142 |
|
135 |
| - <p> <%= mobCnt %> MobFile(s) in set.</p> |
| 143 | + <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> |
136 | 144 | </table>
|
137 | 145 | <% }
|
138 | 146 | }
|
|
0 commit comments