HBASE-26962: Add mob info in web UI (#4359)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
(cherry picked from commit d03004060da4084ff858d999faca6d8a4244d8a5)
This commit is contained in:
liangxs 2022-06-02 23:53:03 +08:00 committed by Duo Zhang
parent 8270b5df5e
commit 7a02cbfd7e

View File

@ -18,11 +18,18 @@
*/ */
--%> --%>
<%@ page contentType="text/html;charset=UTF-8" <%@ page contentType="text/html;charset=UTF-8"
import="java.net.URLEncoder"
import="java.util.Collection" import="java.util.Collection"
import="java.util.Date" import="java.util.Date"
import="java.util.List" import="java.util.List"
import="org.apache.hadoop.fs.FileStatus"
import="org.apache.hadoop.fs.Path"
import="org.apache.hadoop.hbase.HConstants"
import="org.apache.hadoop.hbase.client.RegionInfoDisplay" import="org.apache.hadoop.hbase.client.RegionInfoDisplay"
import="org.apache.hadoop.hbase.mob.MobUtils"
import="org.apache.hadoop.hbase.regionserver.HRegionServer" import="org.apache.hadoop.hbase.regionserver.HRegionServer"
import="org.apache.hadoop.hbase.regionserver.HMobStore"
import="org.apache.hadoop.hbase.regionserver.HStoreFile"
import="org.apache.hadoop.hbase.regionserver.Region" import="org.apache.hadoop.hbase.regionserver.Region"
import="org.apache.hadoop.hbase.regionserver.Store" import="org.apache.hadoop.hbase.regionserver.Store"
import="org.apache.hadoop.hbase.regionserver.StoreFile" import="org.apache.hadoop.hbase.regionserver.StoreFile"
@ -80,7 +87,51 @@
<p> <%= storeFiles.size() %> StoreFile(s) in set.</p> <p> <%= storeFiles.size() %> StoreFile(s) in set.</p>
</table> </table>
<% if (store instanceof HMobStore) { %>
<h4>MOB Files</h4>
<table class="table table-striped">
<tr>
<th>MOB File</th>
<th>Size (MB)</th>
<th>Modification time</th>
</tr>
<%
int mobCnt = 0;
for (StoreFile sf : storeFiles) {
try {
byte[] value = ((HStoreFile)sf).getMetadataValue(HStoreFile.MOB_FILE_REFS);
if (value == null) {
continue;
}
Collection<String> fileNames = MobUtils.deserializeMobFileRefs(value).build().values();
mobCnt += fileNames.size();
for (String fileName : fileNames) {
Path mobPath = new Path(((HMobStore) store).getPath(), fileName);
FileStatus status = rs.getFileSystem().getFileStatus(mobPath);
String mobPathStr = mobPath.toString();
String encodedStr = URLEncoder.encode(mobPathStr, HConstants.UTF8_ENCODING); %>
<tr>
<td><a href="storeFile.jsp?name=<%= encodedStr%>"><%= mobPathStr%></a></td>
<td><%= status.getLen() / 1024 / 1024 %></td>
<td><%= new Date(status.getModificationTime()) %></td>
</tr>
<% } <% }
} catch (Exception e) { %>
<tr>
<td><%= e %></td>
</tr>
<% }
} %>
<p> <%= mobCnt %> MobFile(s) in set.</p>
</table>
<% }
}
}%> }%>
</div> </div>