HBASE-22096 /storeFile.jsp shows CorruptHFileException when the storeFile is a reference file (#888)

Signed-off-by: Lijin Bin <binlijin@apache.org>
This commit is contained in:
Toshihiro Suzuki 2019-12-03 15:15:40 +09:00 committed by GitHub
parent 27cfe1bb27
commit 0f166edc3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -21,14 +21,17 @@
import="java.io.ByteArrayOutputStream" import="java.io.ByteArrayOutputStream"
import="java.io.PrintStream" import="java.io.PrintStream"
import="org.apache.hadoop.conf.Configuration" import="org.apache.hadoop.conf.Configuration"
import="org.apache.hadoop.fs.FileSystem"
import="org.apache.hadoop.fs.Path" import="org.apache.hadoop.fs.Path"
import="org.apache.hadoop.hbase.io.hfile.HFilePrettyPrinter" import="org.apache.hadoop.hbase.io.hfile.HFilePrettyPrinter"
import="org.apache.hadoop.hbase.regionserver.HRegionServer" import="org.apache.hadoop.hbase.regionserver.HRegionServer"
import="org.apache.hadoop.hbase.regionserver.StoreFileInfo"
%> %>
<% <%
String storeFile = request.getParameter("name"); String storeFile = request.getParameter("name");
HRegionServer rs = (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); HRegionServer rs = (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER);
Configuration conf = rs.getConfiguration(); Configuration conf = rs.getConfiguration();
FileSystem fs = FileSystem.get(conf);
pageContext.setAttribute("pageTitle", "HBase RegionServer: " + rs.getServerName()); pageContext.setAttribute("pageTitle", "HBase RegionServer: " + rs.getServerName());
%> %>
<jsp:include page="header.jsp"> <jsp:include page="header.jsp">
@ -51,7 +54,8 @@
printer.setConf(conf); printer.setConf(conf);
String[] options = {"-s"}; String[] options = {"-s"};
printer.parseOptions(options); printer.parseOptions(options);
printer.processFile(new Path(storeFile), true); StoreFileInfo sfi = new StoreFileInfo(conf, fs, new Path(storeFile), true);
printer.processFile(sfi.getFileStatus().getPath(), true);
String text = byteStream.toString();%> String text = byteStream.toString();%>
<%= <%=
text text