hbase-webapps.master.snapshot.jsp Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hbase-server Show documentation
Show all versions of hbase-server Show documentation
Server functionality for HBase
<%--
/**
* 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="org.apache.hadoop.conf.Configuration"
import="org.apache.hadoop.hbase.client.Admin"
import="org.apache.hadoop.hbase.client.SnapshotDescription"
import="org.apache.hadoop.hbase.http.InfoServer"
import="org.apache.hadoop.hbase.master.HMaster"
import="org.apache.hadoop.hbase.snapshot.SnapshotInfo"
import="org.apache.hadoop.util.StringUtils"
import="org.apache.hadoop.hbase.TableName"
%>
<%
HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER);
Configuration conf = master.getConfiguration();
boolean readOnly = !InfoServer.canUserModifyUI(request, getServletContext(), conf);
String snapshotName = request.getParameter("name");
SnapshotDescription snapshot = null;
SnapshotInfo.SnapshotStats stats = null;
TableName snapshotTable = null;
boolean tableExists = false;
long snapshotTtl = 0;
if(snapshotName != null && master.isInitialized()) {
try (Admin admin = master.getConnection().getAdmin()) {
for (SnapshotDescription snapshotDesc: admin.listSnapshots()) {
if (snapshotName.equals(snapshotDesc.getName())) {
snapshot = snapshotDesc;
stats = SnapshotInfo.getSnapshotStats(conf, snapshot);
snapshotTable = snapshot.getTableName();
snapshotTtl = snapshot.getTtl();
tableExists = admin.tableExists(snapshotTable);
break;
}
}
}
}
String action = request.getParameter("action");
boolean isActionResultPage = (!readOnly && action != null);
String pageTitle;
if (isActionResultPage) {
pageTitle = "HBase Master: " + master.getServerName();
} else {
pageTitle = "Snapshot: " + snapshotName;
}
pageContext.setAttribute("pageTitle", pageTitle);
%>
<% if (!master.isInitialized()) { %>
Master is not initialized
<% } else if (snapshot == null) { %>
Snapshot "<%= snapshotName %>" does not exist
<% } else { %>
Snapshot: <%= snapshotName %>
Snapshot Attributes
Table
Creation Time
Time To Live(Sec)
Type
Format Version
State
<% if (tableExists) { %>
<%= snapshotTable.getNameAsString() %>
<% } else { %>
<%= snapshotTable.getNameAsString() %>
<% } %>
<%= new Date(snapshot.getCreationTime()) %>
<% if (snapshotTtl == 0) { %>
FOREVER
<% } else { %>
<%= snapshotTtl %>
<% } %>
<%= snapshot.getType() %>
<%= snapshot.getVersion() %>
<% if (stats.isSnapshotCorrupted()) { %>
CORRUPTED
<% } else { %>
ok
<% } %>
<%= stats.getStoreFilesCount() %> HFiles (<%= stats.getArchivedStoreFilesCount() %> in archive),
total size <%= StringUtils.humanReadableInt(stats.getStoreFilesSize()) %>
(<%= stats.getSharedStoreFilePercentage() %>%
<%= StringUtils.humanReadableInt(stats.getSharedStoreFilesSize()) %> shared with the source
table)
<%= stats.getLogsCount() %> Logs, total size
<%= StringUtils.humanReadableInt(stats.getLogsSize()) %>
<% if (stats.isSnapshotCorrupted()) { %>
CORRUPTED Snapshot
<%= stats.getMissingStoreFilesCount() %> hfile(s) and
<%= stats.getMissingLogsCount() %> log(s) missing.
<% } %>
<%
} // end else
%>