|
22 | 22 | import="java.util.Collection" |
23 | 23 | import="java.util.Date" |
24 | 24 | import="java.util.List" |
25 | | - import="org.apache.hadoop.fs.FileStatus" |
| 25 | + import="java.util.Map" |
26 | 26 | import="org.apache.hadoop.fs.FileSystem" |
| 27 | + import="org.apache.hadoop.fs.FileStatus" |
27 | 28 | import="org.apache.hadoop.fs.Path" |
| 29 | + import="org.apache.hadoop.hbase.TableName" |
28 | 30 | import="org.apache.hadoop.hbase.client.RegionInfo" |
29 | 31 | import="org.apache.hadoop.hbase.client.RegionInfoDisplay" |
30 | 32 | import="org.apache.hadoop.hbase.mob.MobUtils" |
|
33 | 35 | import="org.apache.hadoop.hbase.regionserver.HRegion" |
34 | 36 | import="org.apache.hadoop.hbase.regionserver.HStore" |
35 | 37 | import="org.apache.hadoop.hbase.regionserver.HStoreFile" |
| 38 | + import="org.apache.hadoop.hbase.util.CommonFSUtils" |
36 | 39 | %> |
37 | 40 | <%@ page import="java.nio.charset.StandardCharsets" %> |
38 | 41 | <% |
|
116 | 119 |
|
117 | 120 | <% |
118 | 121 | int mobCnt = 0; |
| 122 | + HMobStore mobStore = (HMobStore) store; |
119 | 123 | for (HStoreFile sf : storeFiles) { |
120 | 124 | try { |
121 | 125 | byte[] value = sf.getMetadataValue(HStoreFile.MOB_FILE_REFS); |
122 | 126 | if (value == null) { |
123 | 127 | continue; |
124 | 128 | } |
125 | 129 |
|
126 | | - Collection<String> fileNames = MobUtils.deserializeMobFileRefs(value).build().values(); |
127 | | - mobCnt += fileNames.size(); |
128 | | - for (String fileName : fileNames) { |
129 | | - Path mobPath = new Path(((HMobStore) store).getPath(), fileName); |
130 | | - FileStatus status = fs.getFileStatus(mobPath); |
| 130 | + for (Map.Entry<TableName, String> mobRef : |
| 131 | + MobUtils.deserializeMobFileRefs(value).build().entries()) { |
| 132 | + TableName mobTable = mobRef.getKey(); |
| 133 | + String fileName = mobRef.getValue(); |
| 134 | + Path mobPath = null; |
| 135 | + FileStatus status = null; |
| 136 | + for (Path candidate : mobStore.getLocations(mobTable)) { |
| 137 | + Path p = new Path(candidate, fileName); |
| 138 | + FileStatus[] fileStatuses = CommonFSUtils.listStatus(fs, p); |
| 139 | + if (fileStatuses == null) { |
| 140 | + continue; |
| 141 | + } |
| 142 | + mobPath = p; |
| 143 | + status = fileStatuses[0]; |
| 144 | + break; |
| 145 | + } |
| 146 | +
|
| 147 | + if (mobPath == null) { |
| 148 | + // File not found in any known location (working dir or archive dir) for the referenced table. |
| 149 | + // Nothing to show on the UI, so skip it. |
| 150 | + continue; |
| 151 | + } |
| 152 | +
|
| 153 | + mobCnt ++; |
131 | 154 | String mobPathStr = mobPath.toString(); |
132 | 155 | String encodedStr = URLEncoder.encode(mobPathStr, StandardCharsets.UTF_8.toString()); %> |
133 | 156 |
|
|
0 commit comments