hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmhs...@apache.org
Subject svn commit: r1445794 - in /hbase/branches/hbase-7290/hbase-server/src/main: jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon resources/hbase-webapps/master/snapshot.jsp
Date Wed, 13 Feb 2013 18:19:13 GMT
Author: jmhsieh
Date: Wed Feb 13 18:19:12 2013
New Revision: 1445794

URL: http://svn.apache.org/r1445794
Log:
HBASE-7311 Add snapshot information to hbase master webui (Matteo Bertozzi)


Added:
    hbase/branches/hbase-7290/hbase-server/src/main/resources/hbase-webapps/master/snapshot.jsp
Modified:
    hbase/branches/hbase-7290/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon

Modified: hbase/branches/hbase-7290/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon?rev=1445794&r1=1445793&r2=1445794&view=diff
==============================================================================
--- hbase/branches/hbase-7290/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon
(original)
+++ hbase/branches/hbase-7290/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon
Wed Feb 13 18:19:12 2013
@@ -43,6 +43,7 @@ org.apache.hadoop.hbase.client.HBaseAdmi
 org.apache.hadoop.hbase.client.HConnectionManager;
 org.apache.hadoop.hbase.HTableDescriptor;
 org.apache.hadoop.hbase.HBaseConfiguration;
+org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
 </%import>
 <%if format.equals("json") %>
   <& ../common/TaskMonitorTmpl; filter = filter; format = "json" &>
@@ -146,6 +147,9 @@ org.apache.hadoop.hbase.HBaseConfigurati
                 <li class="">
                     <a href="#catalogTables" data-toggle="tab">Catalog Tables</a>
                 </li>
+                <li class="">
+                    <a href="#userSnapshots" data-toggle="tab">Snapshots</a>
+                </li>
             </ul>
             <div class="tab-content" style="padding-bottom: 9px; border-bottom: 1px solid
#ddd;">
                 <div class="tab-pane active" id="userTables">
@@ -158,6 +162,9 @@ org.apache.hadoop.hbase.HBaseConfigurati
                         <& catalogTables &>
                     </%if>
                 </div>
+                <div class="tab-pane" id="userSnapshots">
+                    <& userSnapshots &>
+                </div>
             </div>
         </div>
 
@@ -277,7 +284,6 @@ org.apache.hadoop.hbase.HBaseConfigurati
 <%def userTables>
 <%java>
    HTableDescriptor[] tables = admin.listTables();
-   HConnectionManager.deleteConnection(admin.getConfiguration(), false);
 </%java>
 <%if (tables != null && tables.length > 0)%>
 <table class="table table-striped">
@@ -302,6 +308,28 @@ org.apache.hadoop.hbase.HBaseConfigurati
 </%if>
 </%def>
 
+<%def userSnapshots>
+<%java>
+   List<SnapshotDescription> snapshots = admin.listSnapshots();
+</%java>
+<%if (snapshots != null && snapshots.size() > 0)%>
+<table class="table table-striped">
+    <tr>
+        <th>Snapshot Name</th>
+        <th>Table</th>
+        <th>Creation Time</th>
+    </tr>
+    <%for SnapshotDescription snapshotDesc : snapshots%>
+    <tr>
+        <td><a href="snapshot.jsp?name=<% snapshotDesc.getName() %>"><%
snapshotDesc.getName() %></a> </td>
+        <td><a href="table.jsp?name=<% snapshotDesc.getTable() %>"><%
snapshotDesc.getTable() %></a></td>
+        <td><% new Date(snapshotDesc.getCreationTime()) %></td>
+    </tr>
+    </%for>
+    <p><% snapshots.size() %> snapshot(s) in set.</p>
+</table>
+</%if>
+</%def>
 
 
 <%def deadRegionServers>
@@ -332,3 +360,7 @@ org.apache.hadoop.hbase.HBaseConfigurati
 </table>
 </%if>
 </%def>
+
+<%java>
+   HConnectionManager.deleteConnection(admin.getConfiguration(), false);
+</%java>
\ No newline at end of file

Added: hbase/branches/hbase-7290/hbase-server/src/main/resources/hbase-webapps/master/snapshot.jsp
URL: http://svn.apache.org/viewvc/hbase/branches/hbase-7290/hbase-server/src/main/resources/hbase-webapps/master/snapshot.jsp?rev=1445794&view=auto
==============================================================================
--- hbase/branches/hbase-7290/hbase-server/src/main/resources/hbase-webapps/master/snapshot.jsp
(added)
+++ hbase/branches/hbase-7290/hbase-server/src/main/resources/hbase-webapps/master/snapshot.jsp
Wed Feb 13 18:19:12 2013
@@ -0,0 +1,221 @@
+<%--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+--%>
+<%@ page contentType="text/html;charset=UTF-8"
+  import="java.util.Date"
+  import="java.util.HashMap"
+  import="org.apache.hadoop.conf.Configuration"
+  import="org.apache.hadoop.hbase.client.HBaseAdmin"
+  import="org.apache.hadoop.hbase.client.HConnectionManager"
+  import="org.apache.hadoop.hbase.HRegionInfo"
+  import="org.apache.hadoop.hbase.ServerName"
+  import="org.apache.hadoop.hbase.ServerLoad"
+  import="org.apache.hadoop.hbase.RegionLoad"
+  import="org.apache.hadoop.hbase.master.HMaster"
+  import="org.apache.hadoop.hbase.util.Bytes"
+  import="org.apache.hadoop.hbase.util.FSUtils"
+  import="org.apache.hadoop.hbase.protobuf.ProtobufUtil"
+  import="org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription"
+  import="java.util.List"
+  import="java.util.Map"
+  import="org.apache.hadoop.hbase.HConstants"%><%
+  HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER);
+  Configuration conf = master.getConfiguration();
+  HBaseAdmin hbadmin = new HBaseAdmin(conf);
+  boolean readOnly = conf.getBoolean("hbase.master.ui.readonly", false);
+  String snapshotName = request.getParameter("name");
+  SnapshotDescription snapshot = null;
+  for (SnapshotDescription snapshotDesc: hbadmin.listSnapshots()) {
+    if (snapshotName.equals(snapshotDesc.getName())) {
+      snapshot = snapshotDesc;
+      break;
+    }
+  }
+
+  String action = request.getParameter("action");
+  String cloneName = request.getParameter("cloneName");
+  boolean isActionResultPage = (!readOnly && action != null);
+%>
+
+<?xml version="1.0" encoding="UTF-8" ?>
+<!-- Commenting out DOCTYPE so our blue outline shows on hadoop 0.20.205.0, etc.
+     See tail of HBASE-2110 for explaination.
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+-->
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta charset="utf-8">
+    <% if (isActionResultPage) { %>
+      <title>HBase Master: <%= master.getServerName() %></title>
+    <% } else { %>
+      <title>Snapshot: <%= snapshotName %></title>
+    <% } %>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta name="description" content="">
+    <meta name="author" content="">
+
+    <link href="/static/css/bootstrap.css" rel="stylesheet">
+    <link href="/static/css/hbase.css" rel="stylesheet">
+    <link href="/static/css/bootstrap-responsive.css" rel="stylesheet">
+    <!--[if lt IE 9]>
+      <script src="/static/js/html5shiv.js"></script>
+    <![endif]-->
+    <% if (isActionResultPage) { %>
+      <meta http-equiv="refresh" content="5,javascript:history.back()" />
+    <% } %>
+  </head>
+<body>
+  <div class="navbar navbar-fixed-top">
+    <div class="navbar-inner">
+      <div class="container">
+        <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+        </a>
+        <a class="brand" href="/master-status">HBase Master</a>
+        <div class="nav-collapse">
+          <ul class="nav">
+              <li><a href="/">Home</a></li>
+              <li><a href="/tablesDetailed.jsp">Table Details</a></li>
+              <li><a href="/logs/">Local logs</a></li>
+              <li><a href="/logLevel">Log Level</a></li>
+              <li><a href="/dump">Debug dump</a></li>
+              <li><a href="/jmx">Metrics Dump</a></li>
+          </ul>
+        </div><!--/.nav-collapse -->
+      </div>
+    </div>
+  </div>
+<% if (isActionResultPage) { %>
+  <div class="container">
+    <div class="row inner_header">
+        <div class="span8">
+          <h1>Snapshot action request...</h1>
+        </div>
+        <div class="span4 logo">
+            <img src="/static/hbase_logo.png" height="66" width="266" alt="HBase logo"/>
+        </div>
+    </div>
+    <p><hr><p>
+<%
+  if (action.equals("restore")) {
+    hbadmin.restoreSnapshot(snapshotName);
+    %> Restore Snapshot request accepted. <%
+  } else if (action.equals("clone")) {
+    if (cloneName != null && cloneName.length() > 0) {
+      hbadmin.cloneSnapshot(snapshotName, cloneName);
+      %> Clone from Snapshot request accepted. <%
+    } else {
+      %> Clone from Snapshot request failed, No table name specified. <%
+    }
+  }
+%>
+<p>Go <a href="javascript:history.back()">Back</a>, or wait for the redirect.
+</div>
+<% } else if (snapshot == null) { %>
+  <div class="container">
+  <div class="row inner_header">
+    <div class="span8">
+      <h1>Snapshot "<%= snapshotName %>" does not exists</h1>
+    </div>
+    <div class="span4 logo">
+        <img src="/static/hbase_logo.png" height="66" width="266" alt="HBase logo"/>
+    </div>
+  </div>
+  <p>Go <a href="javascript:history.back()">Back</a>, or wait for the redirect.
+<% } else { %>
+  <div class="container">
+  <div class="row">
+      <div class="span8">
+          <h1>Snapshot: <%= snapshotName %></h1>
+      </div>
+      <div class="span4">
+          <img src="/static/hbase_logo.png" height="66" width="266" alt="HBase logo"/>
+      </div>
+  </div>
+  <h2>Snapshot Attributes</h2>
+  <table class="table" width="90%" >
+    <tr>
+        <th>Table</th>
+        <th>Creation Time</th>
+        <th>Type</th>
+        <th>Format Version</th>
+    </tr>
+    <tr>
+        <td><a href="table.jsp?name=<%= snapshot.getTable() %>"><%=
snapshot.getTable() %></a></td>
+        <td><%= new Date(snapshot.getCreationTime()) %></td>
+        <td><%= snapshot.getType() %></td>
+        <td><%= snapshot.getVersion() %></td>
+    </tr>
+  </table>
+<%
+  } // end else
+
+HConnectionManager.deleteConnection(hbadmin.getConfiguration(), false);
+%>
+
+
+<% if (!readOnly && action == null && snapshot != null) { %>
+<p><hr><p>
+Actions:
+<p>
+<center>
+<table class="table" width="90%" >
+<tr>
+  <form method="get">
+  <input type="hidden" name="action" value="clone">
+  <input type="hidden" name="name" value="<%= snapshotName %>">
+  <td style="border-style: none; text-align: center">
+      <input style="font-size: 12pt; width: 10em" type="submit" value="Clone" class="btn"></td>
+  <td style="border-style: none" width="5%">&nbsp;</td>
+  <td style="border-style: none">New Table Name (clone):<input type="text" name="cloneName"
size="40"></td>
+  <td style="border-style: none">
+    This action will create a new table by cloning the snapshot content.
+    There are no copies of data involved.
+    And writing on the newly created table will not influence the snapshot data.
+  </td>
+  </form>
+</tr>
+<tr><td style="border-style: none" colspan="4">&nbsp;</td></tr>
+<tr>
+  <form method="get">
+  <input type="hidden" name="action" value="restore">
+  <input type="hidden" name="name" value="<%= snapshotName %>">
+  <td style="border-style: none; text-align: center">
+      <input style="font-size: 12pt; width: 10em" type="submit" value="Restore" class="btn"></td>
+  <td style="border-style: none" width="5%">&nbsp;</td>
+  <td style="border-style: none">&nbsp;</td>
+  <td style="border-style: none">Restore a specified snapshot.
+  The restore will replace the content of the original table,
+  bringing back the content to the snapshot state.
+  The table must be disabled.</td>
+  </form>
+</tr>
+</table>
+</center>
+<p>
+</div>
+<% } %>
+<script src="/static/js/jquery.min.js" type="text/javascript"></script>
+<script src="/static/js/bootstrap.min.js" type="text/javascript"></script>
+
+</body>
+</html>



Mime
View raw message