View Javadoc

1   package org.apache.hadoop.hbase.generated.master;
2   
3   import javax.servlet.*;
4   import javax.servlet.http.*;
5   import javax.servlet.jsp.*;
6   import java.util.Date;
7   import org.apache.hadoop.conf.Configuration;
8   import org.apache.hadoop.hbase.client.Admin;
9   import org.apache.hadoop.hbase.client.SnapshotDescription;
10  import org.apache.hadoop.hbase.master.HMaster;
11  import org.apache.hadoop.hbase.snapshot.SnapshotInfo;
12  import org.apache.hadoop.util.StringUtils;
13  import org.apache.hadoop.hbase.TableName;
14  import org.apache.hadoop.hbase.HBaseConfiguration;
15  
16  public final class snapshot_jsp extends org.apache.jasper.runtime.HttpJspBase
17      implements org.apache.jasper.runtime.JspSourceDependent {
18  
19    private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();
20  
21    private static java.util.Vector _jspx_dependants;
22  
23    private org.apache.jasper.runtime.ResourceInjector _jspx_resourceInjector;
24  
25    public Object getDependants() {
26      return _jspx_dependants;
27    }
28  
29    public void _jspService(HttpServletRequest request, HttpServletResponse response)
30          throws java.io.IOException, ServletException {
31  
32      PageContext pageContext = null;
33      HttpSession session = null;
34      ServletContext application = null;
35      ServletConfig config = null;
36      JspWriter out = null;
37      Object page = this;
38      JspWriter _jspx_out = null;
39      PageContext _jspx_page_context = null;
40  
41      try {
42        response.setContentType("text/html;charset=UTF-8");
43        pageContext = _jspxFactory.getPageContext(this, request, response,
44        			null, true, 8192, true);
45        _jspx_page_context = pageContext;
46        application = pageContext.getServletContext();
47        config = pageContext.getServletConfig();
48        session = pageContext.getSession();
49        out = pageContext.getOut();
50        _jspx_out = out;
51        _jspx_resourceInjector = (org.apache.jasper.runtime.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector");
52  
53        out.write('\n');
54        out.write('\n');
55  
56    HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER);
57    Configuration conf = master.getConfiguration();
58    boolean readOnly = conf.getBoolean("hbase.master.ui.readonly", false);
59    String snapshotName = request.getParameter("name");
60    SnapshotDescription snapshot = null;
61    SnapshotInfo.SnapshotStats stats = null;
62    TableName snapshotTable = null;
63    boolean tableExists = false;
64    try (Admin admin = master.getConnection().getAdmin()) {
65      for (SnapshotDescription snapshotDesc: admin.listSnapshots()) {
66        if (snapshotName.equals(snapshotDesc.getName())) {
67          snapshot = snapshotDesc;
68          stats = SnapshotInfo.getSnapshotStats(conf, snapshot);
69          snapshotTable = TableName.valueOf(snapshot.getTable());
70          tableExists = admin.tableExists(snapshotTable);
71          break;
72        }
73      }
74    }
75  
76    String action = request.getParameter("action");
77    String cloneName = request.getParameter("cloneName");
78    boolean isActionResultPage = (!readOnly && action != null);
79  
80        out.write("\n<!--[if IE]>\n<!DOCTYPE html>\n<![endif]-->\n<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n    <meta charset=\"utf-8\">\n    ");
81   if (isActionResultPage) { 
82        out.write("\n      <title>HBase Master: ");
83        out.print( master.getServerName() );
84        out.write("</title>\n    ");
85   } else { 
86        out.write("\n      <title>Snapshot: ");
87        out.print( snapshotName );
88        out.write("</title>\n    ");
89   } 
90        out.write("\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <meta name=\"description\" content=\"\">\n    <meta name=\"author\" content=\"\">\n\n    <link href=\"/static/css/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"/static/css/bootstrap-theme.min.css\" rel=\"stylesheet\">\n    <link href=\"/static/css/hbase.css\" rel=\"stylesheet\">\n    ");
91   if (isActionResultPage) { 
92        out.write("\n    <script type=\"text/javascript\">\n    <!--\n        setTimeout(\"history.back()\",5000);\n    -->\n    </script>\n    ");
93   } 
94        out.write("\n  </head>\n<body>\n<div class=\"navbar  navbar-fixed-top navbar-default\">\n    <div class=\"container-fluid\">\n        <div class=\"navbar-header\">\n            <button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\".navbar-collapse\">\n                <span class=\"icon-bar\"></span>\n                <span class=\"icon-bar\"></span>\n                <span class=\"icon-bar\"></span>\n            </button>\n            <a class=\"navbar-brand\" href=\"/master-status\"><img src=\"/static/hbase_logo_small.png\" alt=\"HBase Logo\"/></a>\n        </div>\n        <div class=\"collapse navbar-collapse\">\n            <ul class=\"nav navbar-nav\">\n                <li><a href=\"/master-status\">Home</a></li>\n                <li><a href=\"/tablesDetailed.jsp\">Table Details</a></li>\n                <li><a href=\"/procedures.jsp\">Procedures</a></li>\n                <li><a href=\"/logs/\">Local Logs</a></li>\n                <li><a href=\"/logLevel\">Log Level</a></li>\n                <li><a href=\"/dump\">Debug Dump</a></li>\n                <li><a href=\"/jmx\">Metrics Dump</a></li>\n");
95        out.write("                ");
96   if (HBaseConfiguration.isShowConfInServlet()) { 
97        out.write("\n                <li><a href=\"/conf\">HBase Configuration</a></li>\n                ");
98   } 
99        out.write("\n            </ul>\n        </div><!--/.nav-collapse -->\n    </div>\n</div>\n");
100  if (snapshot == null) { 
101       out.write("\n  <div class=\"container-fluid content\">\n  <div class=\"row inner_header\">\n    <div class=\"page-header\">\n      <h1>Snapshot \"");
102       out.print( snapshotName );
103       out.write("\" does not exists</h1>\n    </div>\n  </div>\n  <p>Go <a href=\"javascript:history.back()\">Back</a>, or wait for the redirect.\n");
104  } else { 
105       out.write("\n  <div class=\"container-fluid content\">\n  <div class=\"row\">\n      <div class=\"page-header\">\n          <h1>Snapshot: ");
106       out.print( snapshotName );
107       out.write("</h1>\n      </div>\n  </div>\n  <h2>Snapshot Attributes</h2>\n  <table class=\"table table-striped\" width=\"90%\" >\n    <tr>\n        <th>Table</th>\n        <th>Creation Time</th>\n        <th>Type</th>\n        <th>Format Version</th>\n        <th>State</th>\n    </tr>\n    <tr>\n\n        <td>\n          ");
108  if (tableExists) { 
109       out.write("\n            <a href=\"table.jsp?name=");
110       out.print( snapshotTable.getNameAsString() );
111       out.write("\">\n              ");
112       out.print( snapshotTable.getNameAsString() );
113       out.write("</a>\n          ");
114  } else { 
115       out.write("\n            ");
116       out.print( snapshotTable.getNameAsString() );
117       out.write("\n          ");
118  } 
119       out.write("\n        </td>\n        <td>");
120       out.print( new Date(snapshot.getCreationTime()) );
121       out.write("</td>\n        <td>");
122       out.print( snapshot.getType() );
123       out.write("</td>\n        <td>");
124       out.print( snapshot.getVersion() );
125       out.write("</td>\n        ");
126  if (stats.isSnapshotCorrupted()) { 
127       out.write("\n          <td style=\"font-weight: bold; color: #dd0000;\">CORRUPTED</td>\n        ");
128  } else { 
129       out.write("\n          <td>ok</td>\n        ");
130  } 
131       out.write("\n    </tr>\n  </table>\n  <div class=\"row\">\n    <div class=\"span12\">\n    ");
132       out.print( stats.getStoreFilesCount() );
133       out.write(" HFiles (");
134       out.print( stats.getArchivedStoreFilesCount() );
135       out.write(" in archive),\n    total size ");
136       out.print( StringUtils.humanReadableInt(stats.getStoreFilesSize()) );
137       out.write("\n    (");
138       out.print( stats.getSharedStoreFilePercentage() );
139       out.write("&#37;\n    ");
140       out.print( StringUtils.humanReadableInt(stats.getSharedStoreFilesSize()) );
141       out.write(" shared with the source\n    table)\n    </div>\n    <div class=\"span12\">\n    ");
142       out.print( stats.getLogsCount() );
143       out.write(" Logs, total size\n    ");
144       out.print( StringUtils.humanReadableInt(stats.getLogsSize()) );
145       out.write("\n    </div>\n  </div>\n  ");
146  if (stats.isSnapshotCorrupted()) { 
147       out.write("\n    <div class=\"row\">\n      <div class=\"span12\">\n          <h3>CORRUPTED Snapshot</h3>\n      </div>\n      <div class=\"span12\">\n        ");
148       out.print( stats.getMissingStoreFilesCount() );
149       out.write(" hfile(s) and\n        ");
150       out.print( stats.getMissingLogsCount() );
151       out.write(" log(s) missing.\n      </div>\n    </div>\n  ");
152  } 
153       out.write('\n');
154 
155   } // end else
156 
157       out.write("\n\n\n<script src=\"/static/js/jquery.min.js\" type=\"text/javascript\"></script>\n<script src=\"/static/js/bootstrap.min.js\" type=\"text/javascript\"></script>\n\n</body>\n</html>\n");
158     } catch (Throwable t) {
159       if (!(t instanceof SkipPageException)){
160         out = _jspx_out;
161         if (out != null && out.getBufferSize() != 0)
162           out.clearBuffer();
163         if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
164       }
165     } finally {
166       _jspxFactory.releasePageContext(_jspx_page_context);
167     }
168   }
169 }