diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RESTDumpServlet.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RESTDumpServlet.java new file mode 100644 index 000000000000..8bb306f7829a --- /dev/null +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RESTDumpServlet.java @@ -0,0 +1,80 @@ +/* + * 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. + */ +package org.apache.hadoop.hbase.rest; + +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.util.Date; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.http.HttpServer; +import org.apache.hadoop.hbase.monitoring.StateDumpServlet; +import org.apache.hadoop.hbase.util.LogMonitoring; +import org.apache.hadoop.hbase.util.Threads; +import org.apache.yetus.audience.InterfaceAudience; + +@InterfaceAudience.Private +public class RESTDumpServlet extends StateDumpServlet { + private static final long serialVersionUID = 1L; + private static final String LINE = "==========================================================="; + + @Override + public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { + if (!HttpServer.isInstrumentationAccessAllowed(getServletContext(), request, response)) { + return; + } + + RESTServer restServer = (RESTServer) getServletContext().getAttribute(RESTServer.REST_SERVER); + assert restServer != null : "No REST Server in context!"; + + response.setContentType("text/plain"); + OutputStream os = response.getOutputStream(); + try (PrintWriter out = new PrintWriter(os)) { + + out.println("REST Server status for " + restServer.getServerName() + " as of " + new Date()); + + out.println("\n\nVersion Info:"); + out.println(LINE); + dumpVersionInfo(out); + + out.println("\n\nStacks:"); + out.println(LINE); + out.flush(); + PrintStream ps = new PrintStream(response.getOutputStream(), false, "UTF-8"); + Threads.printThreadInfo(ps, ""); + ps.flush(); + + out.println("\n\nREST Server configuration:"); + out.println(LINE); + Configuration conf = restServer.conf; + out.flush(); + conf.writeXml(os); + os.flush(); + + out.println("\n\nLogs"); + out.println(LINE); + long tailKb = getTailKbParam(request); + LogMonitoring.dumpTailOfLogs(out, tailKb); + + out.flush(); + } + } +} diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RESTServer.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RESTServer.java index 5796cd066f9d..dea6f2909875 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RESTServer.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RESTServer.java @@ -20,6 +20,7 @@ import static org.apache.hadoop.hbase.http.HttpServerUtil.PATH_SPEC_ANY; import java.lang.management.ManagementFactory; +import java.net.UnknownHostException; import java.util.ArrayList; import java.util.EnumSet; import java.util.List; @@ -31,6 +32,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HBaseInterfaceAudience; +import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.http.HttpServerUtil; import org.apache.hadoop.hbase.http.InfoServer; import org.apache.hadoop.hbase.log.HBaseMarkers; @@ -83,6 +85,7 @@ @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.TOOLS) public class RESTServer implements Constants { static Logger LOG = LoggerFactory.getLogger("RESTServer"); + public static final String REST_SERVER = "rest"; static final String REST_CSRF_ENABLED_KEY = "hbase.rest.csrf.enabled"; static final boolean REST_CSRF_ENABLED_DEFAULT = false; @@ -110,6 +113,7 @@ public class RESTServer implements Constants { private final UserProvider userProvider; private Server server; private InfoServer infoServer; + private ServerName serverName; public RESTServer(Configuration conf) { RESTServer.conf = conf; @@ -143,8 +147,7 @@ void addCSRFFilter(ServletContextHandler ctxHandler, Configuration conf) { loginServerPrincipal(UserProvider userProvider, Configuration conf) throws Exception { Class containerClass = ServletContainer.class; if (userProvider.isHadoopSecurityEnabled() && userProvider.isHBaseSecurityEnabled()) { - String machineName = Strings.domainNamePointerToHostName(DNS.getDefaultHost( - conf.get(REST_DNS_INTERFACE, "default"), conf.get(REST_DNS_NAMESERVER, "default"))); + String machineName = getHostName(conf); String keytabFilename = conf.get(REST_KEYTAB_FILE); Preconditions.checkArgument(keytabFilename != null && !keytabFilename.isEmpty(), REST_KEYTAB_FILE + " should be set if security is enabled"); @@ -385,9 +388,14 @@ public synchronized void run() throws Exception { // Put up info server. int port = conf.getInt("hbase.rest.info.port", 8085); if (port >= 0) { - conf.setLong("startcode", EnvironmentEdgeManager.currentTime()); - String a = conf.get("hbase.rest.info.bindAddress", "0.0.0.0"); - this.infoServer = new InfoServer("rest", a, port, false, conf); + final long startCode = EnvironmentEdgeManager.currentTime(); + conf.setLong("startcode", startCode); + this.serverName = ServerName.valueOf(getHostName(conf), servicePort, startCode); + + String addr = conf.get("hbase.rest.info.bindAddress", "0.0.0.0"); + this.infoServer = new InfoServer(REST_SERVER, addr, port, false, conf); + this.infoServer.addPrivilegedServlet("dump", "/dump", RESTDumpServlet.class); + this.infoServer.setAttribute(REST_SERVER, this); this.infoServer.setAttribute("hbase.conf", conf); this.infoServer.start(); } @@ -395,6 +403,11 @@ public synchronized void run() throws Exception { server.start(); } + private static String getHostName(Configuration conf) throws UnknownHostException { + return Strings.domainNamePointerToHostName(DNS.getDefaultHost( + conf.get(REST_DNS_INTERFACE, "default"), conf.get(REST_DNS_NAMESERVER, "default"))); + } + public synchronized void join() throws Exception { if (server == null) { throw new IllegalStateException("Server is not running"); @@ -402,7 +415,19 @@ public synchronized void join() throws Exception { server.join(); } + private void stopInfoServer() { + if (this.infoServer != null) { + LOG.info("Stop info server"); + try { + this.infoServer.stop(); + } catch (Exception e) { + LOG.error("Failed to stop infoServer", e); + } + } + } + public synchronized void stop() throws Exception { + stopInfoServer(); if (server == null) { throw new IllegalStateException("Server is not running"); } @@ -426,6 +451,10 @@ public synchronized int getInfoPort() { return infoServer.getPort(); } + public ServerName getServerName() { + return serverName; + } + public Configuration getConf() { return conf; } diff --git a/hbase-rest/src/main/resources/hbase-webapps/rest/footer.jsp b/hbase-rest/src/main/resources/hbase-webapps/rest/footer.jsp new file mode 100644 index 000000000000..a642ac36eff7 --- /dev/null +++ b/hbase-rest/src/main/resources/hbase-webapps/rest/footer.jsp @@ -0,0 +1,32 @@ +<%-- +/** +* 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. +*/ +--%> + + + + + + + + diff --git a/hbase-rest/src/main/resources/hbase-webapps/rest/header.jsp b/hbase-rest/src/main/resources/hbase-webapps/rest/header.jsp new file mode 100644 index 000000000000..67f7656de592 --- /dev/null +++ b/hbase-rest/src/main/resources/hbase-webapps/rest/header.jsp @@ -0,0 +1,74 @@ +<%-- +/** +* 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="org.apache.hadoop.hbase.HBaseConfiguration"%> + + + + + + + <%= request.getParameter("pageTitle")%> + + + + + + + + + + + diff --git a/hbase-rest/src/main/resources/hbase-webapps/rest/processRest.jsp b/hbase-rest/src/main/resources/hbase-webapps/rest/processRest.jsp new file mode 100644 index 000000000000..2b2d35fbfb3f --- /dev/null +++ b/hbase-rest/src/main/resources/hbase-webapps/rest/processRest.jsp @@ -0,0 +1,184 @@ +<%-- +/** + * 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.List" + import="javax.management.ObjectName" + import="java.lang.management.ManagementFactory" + import="java.lang.management.MemoryPoolMXBean" + import="java.lang.management.RuntimeMXBean" + import="java.lang.management.GarbageCollectorMXBean" + import="org.apache.hadoop.hbase.util.JSONMetricUtil" + import="org.apache.hadoop.hbase.procedure2.util.StringUtils" + import="org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix" +%> + +<% +RuntimeMXBean runtimeBean = ManagementFactory.getRuntimeMXBean(); +ObjectName jvmMetrics = new ObjectName("Hadoop:service=HBase,name=JvmMetrics"); + +// There is always two of GC collectors +List gcBeans = JSONMetricUtil.getGcCollectorBeans(); +GarbageCollectorMXBean collector1 = null; +GarbageCollectorMXBean collector2 = null; +try { +collector1 = gcBeans.get(0); +collector2 = gcBeans.get(1); +} catch(IndexOutOfBoundsException e) {} +List mPools = JSONMetricUtil.getMemoryPools(); +pageContext.setAttribute("pageTitle", "Process info for PID: " + JSONMetricUtil.getProcessPID()); +%> + + + + + +
+
+ +
+ + + + + + + + + + + + + + +
StartedUptimePIDOwner
<%= new Date(runtimeBean.getStartTime()) %><%= StringUtils.humanTimeDiff(runtimeBean.getUptime()) %><%= JSONMetricUtil.getProcessPID() %><%= runtimeBean.getSystemProperties().get("user.name") %>
+
+
+
+ +
+ + + + + + + + + + + + + + + + + +
ThreadsNewThreadsRunableThreadsBlockedThreadsWaitingThreadsTimeWaitingThreadsTerminated
<%= JSONMetricUtil.getValueFromMBean(jvmMetrics, "ThreadsNew") %><%= JSONMetricUtil.getValueFromMBean(jvmMetrics, "ThreadsRunnable")%><%= JSONMetricUtil.getValueFromMBean(jvmMetrics, "ThreadsBlocked")%><%= JSONMetricUtil.getValueFromMBean(jvmMetrics, "ThreadsWaiting")%><%= JSONMetricUtil.getValueFromMBean(jvmMetrics, "ThreadsTimedWaiting")%><%= JSONMetricUtil.getValueFromMBean(jvmMetrics, "ThreadsTerminated")%>
+
+
+
+ +
+ <% if (gcBeans.size() == 2) { %> +
+ +
+
+ + + + + + + + + + + +
Collection CountCollection TimeLast duration
<%= collector1.getCollectionCount() %> <%= StringUtils.humanTimeDiff(collector1.getCollectionTime()) %> <%= StringUtils.humanTimeDiff(JSONMetricUtil.getLastGcDuration( + collector1.getObjectName())) %>
+
+
+ + + + + + + + + + + +
Collection CountCollection TimeLast duration
<%= collector2.getCollectionCount() %> <%= StringUtils.humanTimeDiff(collector2.getCollectionTime()) %> <%= StringUtils.humanTimeDiff(JSONMetricUtil.getLastGcDuration( + collector2.getObjectName())) %>
+
+
+
+ <%} else { %> +

Can not display GC Collector stats.

+ <%} %> + Total GC Collection time: <%= StringUtils.humanTimeDiff(collector1.getCollectionTime() + + collector2.getCollectionTime())%> +
+<% for(MemoryPoolMXBean mp:mPools) { +if(mp.getName().contains("Cache")) continue;%> +
+
+ +
+ + + + + + + + + + + + + + + + +
CommitedInitMaxUsedUtilization [%]
<%= TraditionalBinaryPrefix.long2String(mp.getUsage().getCommitted(), "B", 1) %><%= TraditionalBinaryPrefix.long2String(mp.getUsage().getInit(), "B", 1) %><%= TraditionalBinaryPrefix.long2String(mp.getUsage().getMax(), "B", 1) %><%= TraditionalBinaryPrefix.long2String(mp.getUsage().getUsed(), "B", 1) %><%= JSONMetricUtil.calcPercentage(mp.getUsage().getUsed(), + mp.getUsage().getCommitted()) %>
+
+<% } %> + + diff --git a/hbase-rest/src/main/resources/hbase-webapps/rest/rest.jsp b/hbase-rest/src/main/resources/hbase-webapps/rest/rest.jsp index 3deb2bbc7357..ce6725f283a7 100644 --- a/hbase-rest/src/main/resources/hbase-webapps/rest/rest.jsp +++ b/hbase-rest/src/main/resources/hbase-webapps/rest/rest.jsp @@ -18,60 +18,29 @@ */ --%> <%@ page contentType="text/html;charset=UTF-8" - import="org.apache.hadoop.conf.Configuration" - import="org.apache.hadoop.hbase.HBaseConfiguration" - import="org.apache.hadoop.hbase.rest.model.VersionModel" - import="org.apache.hadoop.hbase.util.VersionInfo" - import="java.util.Date"%> + import="org.apache.hadoop.conf.Configuration" + import="org.apache.hadoop.hbase.rest.RESTServer" + import="org.apache.hadoop.hbase.rest.model.VersionModel" + import="org.apache.hadoop.hbase.util.VersionInfo" + import="java.util.Date"%> + <% -Configuration conf = (Configuration)getServletContext().getAttribute("hbase.conf"); -long startcode = conf.getLong("startcode", System.currentTimeMillis()); -String listenPort = conf.get("hbase.rest.port", "8080"); -%> - - - - - - HBase REST Server: <%= listenPort %> - - + Configuration conf = (Configuration) getServletContext().getAttribute("hbase.conf"); + long startcode = conf.getLong("startcode", System.currentTimeMillis()); - - - - + final RESTServer restServer = (RESTServer) getServletContext().getAttribute(RESTServer.REST_SERVER); + final String hostName = restServer.getServerName().getHostname(); + pageContext.setAttribute("pageTitle", "HBase REST Server" + hostName); +%> - - + + +
@@ -114,9 +83,6 @@ String listenPort = conf.get("hbase.rest.port", "8080");
- - - - - + + diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon index 863d7e039a40..c586b2226646 100644 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon +++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon @@ -162,7 +162,17 @@ AssignmentManager assignmentManager = master.getAssignmentManager();
  • Local Logs
  • Log Level
  • Debug Dump
  • -
  • Metrics Dump
  • +
  • Profiler
  • <%if HBaseConfiguration.isShowConfInServlet()%>
  • HBase Configuration
  • diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon index 2068c7607990..d837b8504623 100644 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon +++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon @@ -114,7 +114,17 @@ org.apache.hadoop.hbase.zookeeper.MasterAddressTracker;
  • Operation Details
  • Log Level
  • Debug Dump
  • -
  • Metrics Dump
  • +
  • Profiler
  • <%if HBaseConfiguration.isShowConfInServlet()%>
  • HBase Configuration
  • @@ -289,7 +299,12 @@ $(document).ready(function() type: "numeric" }); - $("#baseStatsTable").tablesorter(); + $("#baseStatsTable").tablesorter({ + headers: { + 1: {empty: 'emptyMin'}, + 2: {empty: 'emptyMax'} + } + }); $("#requestStatsTable").tablesorter({ headers: { 1: {sorter: 'separator'}, diff --git a/hbase-server/src/main/resources/hbase-webapps/master/header.jsp b/hbase-server/src/main/resources/hbase-webapps/master/header.jsp index 7f4fa55f59da..54ffd4e03415 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/header.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/header.jsp @@ -69,7 +69,17 @@
  • Local Logs
  • Log Level
  • Debug Dump
  • -
  • Metrics Dump
  • +
  • Profiler
  • <% if (HBaseConfiguration.isShowConfInServlet()) { %>
  • HBase Configuration
  • diff --git a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp index 8b88f20301d4..6ae98b6985e5 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp @@ -93,7 +93,7 @@ * its region server. * @return an anchor tag if one can be built, {@code null} otherwise. */ - private static String buildRegionServerLink(final ServerName serverName, final int rsInfoPort, + private static String buildRegionLink(final ServerName serverName, final int rsInfoPort, final RegionInfo regionInfo, final RegionState.State regionState) { if (serverName == null || regionInfo == null) { return null; } @@ -107,15 +107,74 @@ + "?name=" + regionInfo.getEncodedName(); return "" + serverName.getServerName() + ""; } + + /** + * Render an tag contents server name which the given region deploys. + * Links to the server rs-status page. + * not deployed instead if can not find the deploy message. + * @return an tag contents server name links to server rs-status page. + */ + private static String buildRegionDeployedServerTag(RegionInfo regionInfo, HMaster master, + Map regionsToServer) { + ServerName serverName = regionsToServer.get(regionInfo); + + if (serverName == null) { + return "not deployed"; + } + + String hostName = serverName.getHostname(); + String hostNameEncoded = URLEncoder.encode(hostName); + // This port might be wrong if RS actually ended up using something else. + int serverInfoPort = master.getRegionServerInfoPort(serverName); + String urlRegionServer = "//" + hostNameEncoded + ":" + serverInfoPort + "/rs-status"; + + return "" + StringEscapeUtils.escapeHtml4(hostName) + + ":" + serverInfoPort + ""; + } + + /** + * @return an

    tag guide user to see all region messages. + */ + private static String moreRegionsToRender(int numRegionsRendered, int numRegions, String fqtn) { + if (numRegions > numRegionsRendered) { + String allRegionsUrl = "?name=" + URLEncoder.encode(fqtn) + "&numRegions=all"; + + return "This table has " + numRegions + + " regions in total, in order to improve the page load time, only " + + numRegionsRendered + " regions are displayed here, click here to see all regions.

    "; + } + return ""; + } %> + + + + + <% final String ZEROMB = "0 MB"; HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER); Configuration conf = master.getConfiguration(); String fqtn = request.getParameter("name"); + // handle the case for fqtn is null or master is not initialized with error message + redirect + if (fqtn == null || !master.isInitialized()) { +%> +
    +
    + +
    +


    + +

    +<% return; + } %> + +<% final String escaped_fqtn = StringEscapeUtils.escapeHtml4(fqtn); - Table table; - boolean withReplica = false; + Table table = master.getConnection().getTable(TableName.valueOf(fqtn)); boolean showFragmentation = conf.getBoolean("hbase.master.ui.fragmentation.enabled", false); boolean readOnly = !InfoServer.canUserModifyUI(request, getServletContext(), conf); int numMetaReplicas = @@ -162,35 +221,50 @@ final MetaBrowser metaBrowser = new MetaBrowser(connection, request); %> - - - - -<% - if (fqtn != null && master.isInitialized()) { - try { - table = master.getConnection().getTable(TableName.valueOf(fqtn)); - if (table.getTableDescriptor().getRegionReplication() > 1) { - withReplica = true; - } - if ( !readOnly && action != null ) { -%> -
    -
    - -


    - <% - if (action.equals("split")) { +<% return; + } %> + +<% // table split/major compact/compact/merge actions + if ( !readOnly && action != null ) { %> +

    +
    + +
    +


    +<% if (action.equals("split")) { if (key != null && key.length() > 0) { admin.split(TableName.valueOf(fqtn), Bytes.toBytes(key)); } else { admin.split(TableName.valueOf(fqtn)); } +%> Split request accepted. <% + } else if (action.equals("major compact")) { + if (key != null && key.length() > 0) { + List regions = admin.getRegions(TableName.valueOf(fqtn)).get(); + byte[] row = Bytes.toBytes(key); - %> Split request accepted. <% + for (RegionInfo region : regions) { + if (region.containsRow(row)) { + admin.majorCompactRegion(region.getRegionName()); + } + } + } else { + admin.majorCompact(TableName.valueOf(fqtn)); + } +%> major Compact request accepted. <% } else if (action.equals("compact")) { if (key != null && key.length() > 0) { List regions = admin.getRegions(TableName.valueOf(fqtn)).get(); @@ -204,239 +278,229 @@ } else { admin.compact(TableName.valueOf(fqtn)); } - %> Compact request accepted. <% +%> Compact request accepted. <% } else if (action.equals("merge")) { - if (left != null && left.length() > 0 && right != null && right.length() > 0) { - admin.mergeRegions(Bytes.toBytesBinary(left), Bytes.toBytesBinary(right), false); - } - %> Merge request accepted. <% - } -%> - -

    -<% -} else { -%> -
    -
    - +<% return; + } %> + +
    +
    + -
    - <% - if(fqtn.equals(TableName.META_TABLE_NAME.getNameAsString())) { - %> -

    Table Regions

    -
    - -
    -
    - - - - - - - - - - - - - <% - if (withReplica) { - %> - - <% - } - %> - - - - <% - // NOTE: Presumes meta with one or more replicas - for (int j = 0; j < numMetaReplicas; j++) { - RegionInfo meta = RegionReplicaUtil.getRegionInfoForReplica( - RegionInfoBuilder.FIRST_META_REGIONINFO, j); - //If a metaLocation is null, All of its info would be empty here to be displayed. - RegionStateNode rsn = master.getAssignmentManager().getRegionStates() - .getRegionStateNode(meta); - ServerName metaLocation = rsn != null ? rsn.getRegionLocation() : null; - for (int i = 0; i < 1; i++) { - //If metaLocation is null, default value below would be displayed in UI. - String hostAndPort = ""; - String readReq = "N/A"; - String writeReq = "N/A"; - String fileSize = ZEROMB; - String fileCount = "N/A"; - String memSize = ZEROMB; - if (metaLocation != null) { - ServerMetrics sl = master.getServerManager().getLoad(metaLocation); - // The host name portion should be safe, but I don't know how we handle IDNs so err on the side of failing safely. - hostAndPort = URLEncoder.encode(metaLocation.getHostname()) + ":" + master.getRegionServerInfoPort(metaLocation); - if (sl != null) { - Map map = sl.getRegionMetrics(); - if (map.containsKey(meta.getRegionName())) { - RegionMetrics load = map.get(meta.getRegionName()); - readReq = String.format("%,1d", load.getReadRequestCount()); - writeReq = String.format("%,1d", load.getWriteRequestCount()); - double rSize = load.getStoreFileSize().get(Size.Unit.BYTE); - if (rSize > 0) { - fileSize = StringUtils.byteDesc((long) rSize); - } - fileCount = String.format("%,1d", load.getStoreFileCount()); - double mSize = load.getMemStoreSize().get(Size.Unit.BYTE); - if (mSize > 0) { - memSize = StringUtils.byteDesc((long)mSize); - } - } + + +
    +<% //Meta table. + if(fqtn.equals(TableName.META_TABLE_NAME.getNameAsString())) { %> +

    Table Regions

    +
    + + +
    +
    +
    NameRegion ServerReadRequestsWriteRequestsStorefileSizeNum.StorefilesMemSizeStart KeyEnd KeyReplicaID
    + + + + + + + + + + + + + + + + + <% + // NOTE: Presumes meta with one or more replicas + for (int j = 0; j < numMetaReplicas; j++) { + RegionInfo meta = RegionReplicaUtil.getRegionInfoForReplica( + RegionInfoBuilder.FIRST_META_REGIONINFO, j); + //If a metaLocation is null, All of its info would be empty here to be displayed. + RegionStateNode rsn = master.getAssignmentManager().getRegionStates() + .getRegionStateNode(meta); + ServerName metaLocation = rsn != null ? rsn.getRegionLocation() : null; + for (int i = 0; i < 1; i++) { + //If metaLocation is null, default value below would be displayed in UI. + String hostAndPort = ""; + String readReq = "N/A"; + String writeReq = "N/A"; + String fileSizeUncompressed = ZEROMB; + String fileSize = ZEROMB; + String fileCount = "N/A"; + String memSize = ZEROMB; + if (metaLocation != null) { + ServerMetrics sl = master.getServerManager().getLoad(metaLocation); + // The host name portion should be safe, but I don't know how we handle IDNs so err on the side of failing safely. + hostAndPort = URLEncoder.encode(metaLocation.getHostname()) + ":" + master.getRegionServerInfoPort(metaLocation); + if (sl != null) { + Map map = sl.getRegionMetrics(); + if (map.containsKey(meta.getRegionName())) { + RegionMetrics load = map.get(meta.getRegionName()); + readReq = String.format("%,1d", load.getReadRequestCount()); + writeReq = String.format("%,1d", load.getWriteRequestCount()); + double rSize = load.getStoreFileSize().get(Size.Unit.BYTE); + if (rSize > 0) { + fileSize = StringUtils.byteDesc((long) rSize); + } + double rSizeUncompressed = load.getUncompressedStoreFileSize().get(Size.Unit.BYTE); + if (rSizeUncompressed > 0) { + fileSizeUncompressed = StringUtils.byteDesc((long) rSizeUncompressed); + } + fileCount = String.format("%,1d", load.getStoreFileCount()); + double mSize = load.getMemStoreSize().get(Size.Unit.BYTE); + if (mSize > 0) { + memSize = StringUtils.byteDesc((long)mSize); } } - %> - - - - - - - - - - - <% - if (withReplica) { - %> - - <% } - %> - - <% } %> - <%} %> - -
    NameRegion ServerReadRequestsWriteRequestsUncompressed StoreFileSizeStorefileSizeNum.StorefilesMemSizeStart KeyEnd KeyReplicaID
    <%= escapeXml(meta.getRegionNameAsString()) %><%= StringEscapeUtils.escapeHtml4(hostAndPort) %><%= readReq%><%= writeReq%><%= fileSize%><%= fileCount%><%= memSize%><%= escapeXml(Bytes.toString(meta.getStartKey())) %><%= escapeXml(Bytes.toString(meta.getEndKey())) %><%= meta.getReplicaId() %>
    -
    -
    - - - - - - - - - - - <% - // NOTE: Presumes meta with one or more replicas - for (int j = 0; j < numMetaReplicas; j++) { - RegionInfo meta = RegionReplicaUtil.getRegionInfoForReplica( - RegionInfoBuilder.FIRST_META_REGIONINFO, j); - //If a metaLocation is null, All of its info would be empty here to be displayed. - RegionStateNode rsn = master.getAssignmentManager().getRegionStates() - .getRegionStateNode(meta); - ServerName metaLocation = rsn != null ? rsn.getRegionLocation() : null; - for (int i = 0; i < 1; i++) { - //If metaLocation is null, default value below would be displayed in UI. - String hostAndPort = ""; - float locality = 0.0f; - float localityForSsd = 0.0f; - if (metaLocation != null) { - ServerMetrics sl = master.getServerManager().getLoad(metaLocation); - hostAndPort = URLEncoder.encode(metaLocation.getHostname()) + ":" + master.getRegionServerInfoPort(metaLocation); - if (sl != null) { - Map map = sl.getRegionMetrics(); - if (map.containsKey(meta.getRegionName())) { - RegionMetrics load = map.get(meta.getRegionName()); - locality = load.getDataLocality(); - localityForSsd = load.getDataLocalityForSsd(); - } - } + } + %> + + + + + + + + + + + + + + <% } %> + <%} %> + +
    NameRegion ServerLocalityLocalityForSsd
    <%= escapeXml(meta.getRegionNameAsString()) %><%= StringEscapeUtils.escapeHtml4(hostAndPort) %><%= readReq%><%= writeReq%><%= fileSizeUncompressed%><%= fileSize%><%= fileCount%><%= memSize%><%= escapeXml(Bytes.toString(meta.getStartKey())) %><%= escapeXml(Bytes.toString(meta.getEndKey())) %><%= meta.getReplicaId() %>
    +
    +
    + + + + + + + + + + + <% + // NOTE: Presumes meta with one or more replicas + for (int j = 0; j < numMetaReplicas; j++) { + RegionInfo meta = RegionReplicaUtil.getRegionInfoForReplica( + RegionInfoBuilder.FIRST_META_REGIONINFO, j); + //If a metaLocation is null, All of its info would be empty here to be displayed. + RegionStateNode rsn = master.getAssignmentManager().getRegionStates() + .getRegionStateNode(meta); + ServerName metaLocation = rsn != null ? rsn.getRegionLocation() : null; + for (int i = 0; i < 1; i++) { + //If metaLocation is null, default value below would be displayed in UI. + String hostAndPort = ""; + float locality = 0.0f; + float localityForSsd = 0.0f; + if (metaLocation != null) { + ServerMetrics sl = master.getServerManager().getLoad(metaLocation); + hostAndPort = URLEncoder.encode(metaLocation.getHostname()) + ":" + master.getRegionServerInfoPort(metaLocation); + if (sl != null) { + Map map = sl.getRegionMetrics(); + if (map.containsKey(meta.getRegionName())) { + RegionMetrics load = map.get(meta.getRegionName()); + locality = load.getDataLocality(); + localityForSsd = load.getDataLocalityForSsd(); } - %> - - - - - - - <% } %> - <%} %> - -
    NameRegion ServerLocalityLocalityForSsd
    <%= escapeXml(meta.getRegionNameAsString()) %><%= StringEscapeUtils.escapeHtml4(hostAndPort) %><%= locality%><%= localityForSsd%>
    -
    -
    - - - - - - - - - - - - - <% - // NOTE: Presumes meta with one or more replicas - for (int j = 0; j < numMetaReplicas; j++) { - RegionInfo meta = RegionReplicaUtil.getRegionInfoForReplica( + } + } + %> + + + + + + + <% } %> + <%} %> + +
    NameRegion ServerNum. Compacting CellsNum. Compacted CellsRemaining CellsCompaction Progress
    <%= escapeXml(meta.getRegionNameAsString()) %><%= StringEscapeUtils.escapeHtml4(hostAndPort) %><%= locality%><%= localityForSsd%>
    +
    +
    + + + + + + + + + + + + + <% + // NOTE: Presumes meta with one or more replicas + for (int j = 0; j < numMetaReplicas; j++) { + RegionInfo meta = RegionReplicaUtil.getRegionInfoForReplica( RegionInfoBuilder.FIRST_META_REGIONINFO, j); - //If a metaLocation is null, All of its info would be empty here to be displayed. - RegionStateNode rsn = master.getAssignmentManager().getRegionStates() - .getRegionStateNode(meta); - ServerName metaLocation = rsn != null ? rsn.getRegionLocation() : null; - for (int i = 0; i < 1; i++) { - //If metaLocation is null, default value below would be displayed in UI. - String hostAndPort = ""; - long compactingCells = 0; - long compactedCells = 0; - String compactionProgress = ""; - if (metaLocation != null) { - ServerMetrics sl = master.getServerManager().getLoad(metaLocation); - hostAndPort = URLEncoder.encode(metaLocation.getHostname()) + ":" + master.getRegionServerInfoPort(metaLocation); - if (sl != null) { - Map map = sl.getRegionMetrics(); - if (map.containsKey(meta.getRegionName())) { - RegionMetrics load = map.get(meta.getRegionName()); - compactingCells = load.getCompactingCellCount(); - compactedCells = load.getCompactedCellCount(); - if (compactingCells > 0) { - compactionProgress = String.format("%.2f", 100 * ((float) - compactedCells / compactingCells)) + "%"; - } - } + //If a metaLocation is null, All of its info would be empty here to be displayed. + RegionStateNode rsn = master.getAssignmentManager().getRegionStates() + .getRegionStateNode(meta); + ServerName metaLocation = rsn != null ? rsn.getRegionLocation() : null; + for (int i = 0; i < 1; i++) { + //If metaLocation is null, default value below would be displayed in UI. + String hostAndPort = ""; + long compactingCells = 0; + long compactedCells = 0; + String compactionProgress = ""; + if (metaLocation != null) { + ServerMetrics sl = master.getServerManager().getLoad(metaLocation); + hostAndPort = URLEncoder.encode(metaLocation.getHostname()) + ":" + master.getRegionServerInfoPort(metaLocation); + if (sl != null) { + Map map = sl.getRegionMetrics(); + if (map.containsKey(meta.getRegionName())) { + RegionMetrics load = map.get(meta.getRegionName()); + compactingCells = load.getCompactingCellCount(); + compactedCells = load.getCompactedCellCount(); + if (compactingCells > 0) { + compactionProgress = String.format("%.2f", 100 * ((float) + compactedCells / compactingCells)) + "%"; } } - %> - - - - - - - - - <% } %> - <%} %> - -
    NameRegion ServerNum. Compacting CellsNum. Compacted CellsRemaining CellsCompaction Progress
    <%= escapeXml(meta.getRegionNameAsString()) %><%= StringEscapeUtils.escapeHtml4(hostAndPort) %><%= String.format("%,1d", compactingCells)%><%= String.format("%,1d", compactedCells)%><%= String.format("%,1d", compactingCells - compactedCells)%><%= compactionProgress%>
    -
    -
    + } + } + %> + + <%= escapeXml(meta.getRegionNameAsString()) %> + <%= StringEscapeUtils.escapeHtml4(hostAndPort) %> + <%= String.format("%,1d", compactingCells)%> + <%= String.format("%,1d", compactedCells)%> + <%= String.format("%,1d", compactingCells - compactedCells)%> + <%= compactionProgress%> + + <% } %> + <%} %> + +
    -

    Meta Entries

    +
    +
    + +

    Meta Entries

    <% if (!metaBrowser.getErrorMessages().isEmpty()) { for (final String errorMessage : metaBrowser.getErrorMessages()) { @@ -504,6 +568,7 @@ final RegionInfo regionInfo = regionReplicaInfo.getRegionInfo(); final ServerName serverName = regionReplicaInfo.getServerName(); final RegionState.State regionState = regionReplicaInfo.getRegionState(); + final int rsPort = master.getRegionServerInfoPort(serverName); final long seqNum = regionReplicaInfo.getSeqNum(); @@ -521,21 +586,21 @@ splitRegions.entrySet().stream() .map(entry -> String.format(regionSpanFormat, entry.getKey(), entry.getValue().getRegionNameAsString())) .collect(Collectors.joining("
    ")); -%> - - <%= regionNameDisplay %> - <%= startKeyDisplay %> - <%= endKeyDisplay %> - <%= replicaIdDisplay %> - <%= regionStateDisplay %> - "><%= serverName != null ? buildRegionServerLink(serverName, master.getRegionServerInfoPort(serverName), regionInfo, regionState) : "" %> - <%= seqNum %> - <%= targetServerName %> - <%= mergeRegionNames %> - <%= splitName %> - -<% - } + %> + + <%= regionNameDisplay %> + <%= startKeyDisplay %> + <%= endKeyDisplay %> + <%= replicaIdDisplay %> + <%= regionStateDisplay %> + "><%= buildRegionLink(serverName, rsPort, regionInfo, regionState) %> + <%= seqNum %> + <%= targetServerName %> + <%= mergeRegionNames %> + <%= splitName %> + + <% + } metaScanHasMore = results.hasMoreResults(); } @@ -588,555 +653,491 @@ <% } %> - - -
    - + +
    -
    - <%} else { - RegionStates states = master.getAssignmentManager().getRegionStates(); - Map> regionStates = states.getRegionByStateOfTable(table.getName()); - Map stateMap = new HashMap<>(); - for (RegionState.State regionState : regionStates.keySet()) { - for (RegionInfo regionInfo : regionStates.get(regionState)) { - stateMap.put(regionInfo.getEncodedName(), regionState); - } + +
    +
    +<%} else { + //Common tables + RegionStates states = master.getAssignmentManager().getRegionStates(); + Map> regionStates = states.getRegionByStateOfTable(table.getName()); + Map stateMap = new HashMap<>(); + for (RegionState.State regionState : regionStates.keySet()) { + for (RegionInfo regionInfo : regionStates.get(regionState)) { + stateMap.put(regionInfo.getEncodedName(), regionState); + } + } + RegionLocator r = master.getConnection().getRegionLocator(table.getName()); + + try { +%> +

    Table Attributes

    + + + + + + + + + + + + + + + + +<% if (showFragmentation) { %> + + + + + +<% } %> +<% + if (quotasEnabled) { + TableName tn = TableName.valueOf(fqtn); + SpaceQuotaSnapshot masterSnapshot = null; + Quotas quota = QuotaTableUtil.getTableQuota(master.getConnection(), tn); + if (quota == null || !quota.hasSpace()) { + quota = QuotaTableUtil.getNamespaceQuota(master.getConnection(), tn.getNamespaceAsString()); + if (quota != null) { + masterSnapshot = master.getQuotaObserverChore().getNamespaceQuotaSnapshots() + .get(tn.getNamespaceAsString()); } - RegionLocator r = master.getConnection().getRegionLocator(table.getName()); - try { %> -

    Table Attributes

    -
    Attribute NameValueDescription
    Enabled<%= master.getTableStateManager().isTableState(table.getName(), TableState.State.ENABLED) %>Is the table enabled
    Compaction +<% + if (master.getTableStateManager().isTableState(table.getName(), TableState.State.ENABLED)) { + CompactionState compactionState = master.getCompactionState(table.getName()); + %><%= compactionState==null?"UNKNOWN":compactionState %><% + } else { + %><%= CompactionState.NONE %><% + } +%> + Is the table compacting
    Fragmentation<%= frags.get(fqtn) != null ? frags.get(fqtn).intValue() + "%" : "n/a" %>How fragmented is the table. After a major compaction it is 0%.
    - - - - - - - - - - - - - - - - <% if (showFragmentation) { %> - - - - - - <% } %> - <% - if (quotasEnabled) { - TableName tn = TableName.valueOf(fqtn); - SpaceQuotaSnapshot masterSnapshot = null; - Quotas quota = QuotaTableUtil.getTableQuota(master.getConnection(), tn); - if (quota == null || !quota.hasSpace()) { - quota = QuotaTableUtil.getNamespaceQuota(master.getConnection(), tn.getNamespaceAsString()); - if (quota != null) { - masterSnapshot = master.getQuotaObserverChore().getNamespaceQuotaSnapshots() - .get(tn.getNamespaceAsString()); - } - } else { - masterSnapshot = master.getQuotaObserverChore().getTableQuotaSnapshots().get(tn); - } - if (quota != null && quota.hasSpace()) { - SpaceQuota spaceQuota = quota.getSpace(); - %> - - - - - - <% - } - if (quota != null && quota.hasThrottle()) { - List throttles = QuotaSettingsFactory.fromTableThrottles(table.getName(), quota.getThrottle()); - if (throttles.size() > 0) { - %> - - - - - - <% - } - } - } - %> -
    Attribute NameValueDescription
    Enabled<%= master.getTableStateManager().isTableState(table.getName(), TableState.State.ENABLED) %>Is the table enabled
    Compaction - <% - if (master.getTableStateManager().isTableState(table.getName(), TableState.State.ENABLED)) { - CompactionState compactionState = master.getCompactionState(table.getName()); - %><%= compactionState==null?"UNKNOWN":compactionState %><% - } else { - %><%= CompactionState.NONE %><% - } - %> - Is the table compacting
    Fragmentation<%= frags.get(fqtn) != null ? frags.get(fqtn).intValue() + "%" : "n/a" %>How fragmented is the table. After a major compaction it is 0%.
    Space Quota - - - - - - - - - - - - - - <% - if (masterSnapshot != null) { - %> - - - - - - - - - <% - } - %> -
    PropertyValue
    Limit<%= StringUtils.byteDesc(spaceQuota.getSoftLimit()) %>
    Policy<%= spaceQuota.getViolationPolicy() %>
    Usage<%= StringUtils.byteDesc(masterSnapshot.getUsage()) %>
    State<%= masterSnapshot.getQuotaStatus().isInViolation() ? "In Violation" : "In Observance" %>
    -
    Information about a Space Quota on this table, if set.
    Throttle Quota - - - - - - - - <% - for (ThrottleSettings throttle : throttles) { - %> - - - - - - - <% - } - %> -
    LimitTypeTimeUnitScope
    <%= throttle.getSoftLimit() %><%= throttle.getThrottleType() %><%= throttle.getTimeUnit() %><%= throttle.getQuotaScope() %>
    -
    Information about a Throttle Quota on this table, if set.
    -

    Table Schema

    - - <% - ColumnFamilyDescriptor[] families = table.getDescriptor().getColumnFamilies(); - Set familyKeySet = new HashSet<>(); - for (ColumnFamilyDescriptor family: families) { - familyKeySet.addAll(family.getValues().keySet()); + } else { + masterSnapshot = master.getQuotaObserverChore().getTableQuotaSnapshots().get(tn); + } + if (quota != null && quota.hasSpace()) { + SpaceQuota spaceQuota = quota.getSpace(); +%> + + + + + +<% + } + if (quota != null && quota.hasThrottle()) { + List throttles = QuotaSettingsFactory.fromTableThrottles(table.getName(), quota.getThrottle()); + if (throttles.size() > 0) { +%> + + + + + +<% + } + } + } +%> +
    Space Quota + + + + + + + + + + + + + +<% + if (masterSnapshot != null) { +%> + + + + + + + + +<% } +%> +
    PropertyValue
    Limit<%= StringUtils.byteDesc(spaceQuota.getSoftLimit()) %>
    Policy<%= spaceQuota.getViolationPolicy() %>
    Usage<%= StringUtils.byteDesc(masterSnapshot.getUsage()) %>
    State<%= masterSnapshot.getQuotaStatus().isInViolation() ? "In Violation" : "In Observance" %>
    +
    Information about a Space Quota on this table, if set.
    Throttle Quota + + + + + + + +<% + for (ThrottleSettings throttle : throttles) { +%> + + + + + + +<% + } +%> +
    LimitTypeTimeUnitScope
    <%= throttle.getSoftLimit() %><%= throttle.getThrottleType() %><%= throttle.getTimeUnit() %><%= throttle.getQuotaScope() %>
    +
    Information about a Throttle Quota on this table, if set.
    +

    Table Schema

    + +<% + ColumnFamilyDescriptor[] families = table.getDescriptor().getColumnFamilies(); + Set familyKeySet = new HashSet<>(); + for (ColumnFamilyDescriptor family: families) { + familyKeySet.addAll(family.getValues().keySet()); + } +%> + + + <% + for (ColumnFamilyDescriptor family: families) { + %> + + <% } %> + + <% + for (Bytes familyKey: familyKeySet) { %> - + <% for (ColumnFamilyDescriptor family: families) { - %> - - <% } %> - - <% - for (Bytes familyKey: familyKeySet) { - %> - - - <% - for (ColumnFamilyDescriptor family: families) { - String familyValue = "-"; - if(family.getValues().containsKey(familyKey)){ - familyValue = family.getValues().get(familyKey).toString(); - } - %> - - <% } %> - - <% } %> -
    Property \ Column Family Name + <%= StringEscapeUtils.escapeHtml4(family.getNameAsString()) %> +
    Property \ Column Family Name + <%= StringEscapeUtils.escapeHtml4(familyKey.toString()) %> + - <%= StringEscapeUtils.escapeHtml4(family.getNameAsString()) %> -
    - <%= StringEscapeUtils.escapeHtml4(familyKey.toString()) %> - - <%= StringEscapeUtils.escapeHtml4(familyValue) %> -
    - <% - long totalReadReq = 0; - long totalWriteReq = 0; - long totalSize = 0; - long totalStoreFileCount = 0; - long totalMemSize = 0; - long totalCompactingCells = 0; - long totalCompactedCells = 0; - long totalBlocksTotalWeight = 0; - long totalBlocksLocalWeight = 0; - long totalBlocksLocalWithSsdWeight = 0; - String totalCompactionProgress = ""; - String totalMemSizeStr = ZEROMB; - String totalSizeStr = ZEROMB; - String totalLocality = ""; - String totalLocalityForSsd = ""; - String urlRegionServer = null; - Map regDistribution = new TreeMap<>(); - Map primaryRegDistribution = new TreeMap<>(); - List regions = r.getAllRegionLocations(); - Map regionsToLoad = new LinkedHashMap<>(); - Map regionsToServer = new LinkedHashMap<>(); - for (HRegionLocation hriEntry : regions) { - RegionInfo regionInfo = hriEntry.getRegionInfo(); - ServerName addr = hriEntry.getServerName(); - regionsToServer.put(regionInfo, addr); - - if (addr != null) { - ServerMetrics sl = master.getServerManager().getLoad(addr); - if (sl != null) { - RegionMetrics regionMetrics = sl.getRegionMetrics().get(regionInfo.getRegionName()); - regionsToLoad.put(regionInfo, regionMetrics); - if (regionMetrics != null) { - totalReadReq += regionMetrics.getReadRequestCount(); - totalWriteReq += regionMetrics.getWriteRequestCount(); - totalSize += regionMetrics.getStoreFileSize().get(Size.Unit.MEGABYTE); - totalStoreFileCount += regionMetrics.getStoreFileCount(); - totalMemSize += regionMetrics.getMemStoreSize().get(Size.Unit.MEGABYTE); - totalStoreFileSizeMB += regionMetrics.getStoreFileSize().get(Size.Unit.MEGABYTE); - totalCompactingCells += regionMetrics.getCompactingCellCount(); - totalCompactedCells += regionMetrics.getCompactedCellCount(); - totalBlocksTotalWeight += regionMetrics.getBlocksTotalWeight(); - totalBlocksLocalWeight += regionMetrics.getBlocksLocalWeight(); - totalBlocksLocalWithSsdWeight += regionMetrics.getBlocksLocalWithSsdWeight(); - } else { - RegionMetrics load0 = getEmptyRegionMetrics(regionInfo); - regionsToLoad.put(regionInfo, load0); + String familyValue = "-"; + if(family.getValues().containsKey(familyKey)){ + familyValue = family.getValues().get(familyKey).toString(); } - } else{ - RegionMetrics load0 = getEmptyRegionMetrics(regionInfo); - regionsToLoad.put(regionInfo, load0); - } + %> + + <%= StringEscapeUtils.escapeHtml4(familyValue) %> + + <% } %> + + <% } %> + +<% + long totalReadReq = 0; + long totalWriteReq = 0; + long totalSizeUncompressed = 0; + long totalSize = 0; + long totalStoreFileCount = 0; + long totalMemSize = 0; + long totalCompactingCells = 0; + long totalCompactedCells = 0; + long totalBlocksTotalWeight = 0; + long totalBlocksLocalWeight = 0; + long totalBlocksLocalWithSsdWeight = 0; + String totalCompactionProgress = ""; + String totalMemSizeStr = ZEROMB; + String totalSizeUncompressedStr = ZEROMB; + String totalSizeStr = ZEROMB; + String totalLocality = ""; + String totalLocalityForSsd = ""; + String urlRegionServer = null; + Map regDistribution = new TreeMap<>(); + Map primaryRegDistribution = new TreeMap<>(); + List regions = r.getAllRegionLocations(); + Map regionsToLoad = new LinkedHashMap<>(); + Map regionsToServer = new LinkedHashMap<>(); + for (HRegionLocation hriEntry : regions) { + RegionInfo regionInfo = hriEntry.getRegionInfo(); + ServerName addr = hriEntry.getServerName(); + regionsToServer.put(regionInfo, addr); + + if (addr != null) { + ServerMetrics sl = master.getServerManager().getLoad(addr); + if (sl != null) { + RegionMetrics regionMetrics = sl.getRegionMetrics().get(regionInfo.getRegionName()); + regionsToLoad.put(regionInfo, regionMetrics); + if (regionMetrics != null) { + totalReadReq += regionMetrics.getReadRequestCount(); + totalWriteReq += regionMetrics.getWriteRequestCount(); + totalSizeUncompressed += regionMetrics.getUncompressedStoreFileSize().get(Size.Unit.MEGABYTE); + totalSize += regionMetrics.getStoreFileSize().get(Size.Unit.MEGABYTE); + totalStoreFileCount += regionMetrics.getStoreFileCount(); + totalMemSize += regionMetrics.getMemStoreSize().get(Size.Unit.MEGABYTE); + totalStoreFileSizeMB += regionMetrics.getStoreFileSize().get(Size.Unit.MEGABYTE); + totalCompactingCells += regionMetrics.getCompactingCellCount(); + totalCompactedCells += regionMetrics.getCompactedCellCount(); + totalBlocksTotalWeight += regionMetrics.getBlocksTotalWeight(); + totalBlocksLocalWeight += regionMetrics.getBlocksLocalWeight(); + totalBlocksLocalWithSsdWeight += regionMetrics.getBlocksLocalWithSsdWeight(); } else { RegionMetrics load0 = getEmptyRegionMetrics(regionInfo); regionsToLoad.put(regionInfo, load0); } + } else{ + RegionMetrics load0 = getEmptyRegionMetrics(regionInfo); + regionsToLoad.put(regionInfo, load0); } - if (totalSize > 0) { - totalSizeStr = StringUtils.byteDesc(totalSize*1024l*1024); - } - if (totalMemSize > 0) { - totalMemSizeStr = StringUtils.byteDesc(totalMemSize*1024l*1024); - } - if (totalCompactingCells > 0) { - totalCompactionProgress = String.format("%.2f", 100 * - ((float) totalCompactedCells / totalCompactingCells)) + "%"; - } - if (totalBlocksTotalWeight > 0) { - totalLocality = String.format("%.1f", - ((float) totalBlocksLocalWeight / totalBlocksTotalWeight)); - totalLocalityForSsd = String.format("%.1f", - ((float) totalBlocksLocalWithSsdWeight / totalBlocksTotalWeight)); - } - if(regions != null && regions.size() > 0) { %> -

    Table Regions

    -
    - -
    -
    - - - - - - - - - - - - - - <% - if (withReplica) { - %> - - <% - } - %> - - - - <% - List> entryList = new ArrayList<>(regionsToLoad.entrySet()); - numRegions = regions.size(); - int numRegionsRendered = 0; - // render all regions - if (numRegionsToRender < 0) { - numRegionsToRender = numRegions; + } else { + RegionMetrics load0 = getEmptyRegionMetrics(regionInfo); + regionsToLoad.put(regionInfo, load0); + } + } + if (totalSize > 0) { + totalSizeStr = StringUtils.byteDesc(totalSize*1024l*1024); + } + if (totalSizeUncompressed > 0){ + totalSizeUncompressedStr = StringUtils.byteDesc(totalSizeUncompressed*1024l*1024); + } + if (totalMemSize > 0) { + totalMemSizeStr = StringUtils.byteDesc(totalMemSize*1024l*1024); + } + if (totalCompactingCells > 0) { + totalCompactionProgress = String.format("%.2f", 100 * + ((float) totalCompactedCells / totalCompactingCells)) + "%"; + } + if (totalBlocksTotalWeight > 0) { + totalLocality = String.format("%.1f", + ((float) totalBlocksLocalWeight / totalBlocksTotalWeight)); + totalLocalityForSsd = String.format("%.1f", + ((float) totalBlocksLocalWithSsdWeight / totalBlocksTotalWeight)); + } + if(regions != null && regions.size() > 0) { %> +

    Table Regions

    +
    Name(<%= String.format("%,1d", regions.size())%>)Region ServerReadRequests
    (<%= String.format("%,1d", totalReadReq)%>)
    WriteRequests
    (<%= String.format("%,1d", totalWriteReq)%>)
    StorefileSize
    (<%= totalSizeStr %>)
    Num.Storefiles
    (<%= String.format("%,1d", totalStoreFileCount)%>)
    MemSize
    (<%= totalMemSizeStr %>)
    Start KeyEnd KeyRegion StateReplicaID
    + + + + + + + + + + + + + + + + + + <% + List> entryList = new ArrayList<>(regionsToLoad.entrySet()); + numRegions = regions.size(); + int numRegionsRendered = 0; + // render all regions + if (numRegionsToRender < 0) { + numRegionsToRender = numRegions; + } + for (Map.Entry hriEntry : entryList) { + RegionInfo regionInfo = hriEntry.getKey(); + ServerName addr = regionsToServer.get(regionInfo); + RegionMetrics load = hriEntry.getValue(); + String readReq = "N/A"; + String writeReq = "N/A"; + String regionSizeUncompressed = ZEROMB; + String regionSize = ZEROMB; + String fileCount = "N/A"; + String memSize = ZEROMB; + String state = "N/A"; + if (load != null) { + readReq = String.format("%,1d", load.getReadRequestCount()); + writeReq = String.format("%,1d", load.getWriteRequestCount()); + double rSizeUncompressed = load.getUncompressedStoreFileSize().get(Size.Unit.BYTE); + if (rSizeUncompressed > 0) { + regionSizeUncompressed = StringUtils.byteDesc((long)rSizeUncompressed); } - for (Map.Entry hriEntry : entryList) { - RegionInfo regionInfo = hriEntry.getKey(); - ServerName addr = regionsToServer.get(regionInfo); - RegionMetrics load = hriEntry.getValue(); - String readReq = "N/A"; - String writeReq = "N/A"; - String regionSize = ZEROMB; - String fileCount = "N/A"; - String memSize = ZEROMB; - String state = "N/A"; - if (load != null) { - readReq = String.format("%,1d", load.getReadRequestCount()); - writeReq = String.format("%,1d", load.getWriteRequestCount()); - double rSize = load.getStoreFileSize().get(Size.Unit.BYTE); - if (rSize > 0) { - regionSize = StringUtils.byteDesc((long)rSize); - } - fileCount = String.format("%,1d", load.getStoreFileCount()); - double mSize = load.getMemStoreSize().get(Size.Unit.BYTE); - if (mSize > 0) { - memSize = StringUtils.byteDesc((long)mSize); - } - } - if (stateMap.containsKey(regionInfo.getEncodedName())) { - state = stateMap.get(regionInfo.getEncodedName()).toString(); - } - if (addr != null) { - ServerMetrics sl = master.getServerManager().getLoad(addr); - // This port might be wrong if RS actually ended up using something else. - urlRegionServer = - "//" + URLEncoder.encode(addr.getHostname()) + ":" + master.getRegionServerInfoPort(addr) + "/rs-status"; - if(sl != null) { - Integer i = regDistribution.get(addr); - if (null == i) i = Integer.valueOf(0); - regDistribution.put(addr, i + 1); - if (withReplica && RegionReplicaUtil.isDefaultReplica(regionInfo.getReplicaId())) { - i = primaryRegDistribution.get(addr); - if (null == i) i = Integer.valueOf(0); - primaryRegDistribution.put(addr, i+1); - } - } - } - if (numRegionsRendered < numRegionsToRender) { - numRegionsRendered++; - %> - - - <% - if (urlRegionServer != null) { - %> - - <% - } else { - %> - - <% - } - %> - - - - - - - - - <% - if (withReplica) { - %> - - <% - } - %> - - <% } %> - <% } %> - -
    Name(<%= String.format("%,1d", regions.size())%>)Region ServerReadRequests
    (<%= String.format("%,1d", totalReadReq)%>)
    WriteRequests
    (<%= String.format("%,1d", totalWriteReq)%>)
    Uncompressed StoreFileSize
    (<%= totalSizeUncompressedStr %>)
    StorefileSize
    (<%= totalSizeStr %>)
    Num.Storefiles
    (<%= String.format("%,1d", totalStoreFileCount)%>)
    MemSize
    (<%= totalMemSizeStr %>)
    Start KeyEnd KeyRegion StateReplicaID
    <%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %> - <%= addr == null? "-": StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + ":" + master.getRegionServerInfoPort(addr) %> - not deployed<%= readReq%><%= writeReq%><%= regionSize%><%= fileCount%><%= memSize%><%= escapeXml(Bytes.toStringBinary(regionInfo.getStartKey()))%><%= escapeXml(Bytes.toStringBinary(regionInfo.getEndKey()))%><%= state%><%= regionInfo.getReplicaId() %>
    - <% if (numRegions > numRegionsRendered) { - String allRegionsUrl = "?name=" + URLEncoder.encode(fqtn,"UTF-8") + "&numRegions=all"; - %> -

    This table has <%= numRegions %> regions in total, in order to improve the page load time, - only <%= numRegionsRendered %> regions are displayed here, click - here to see all regions.

    - <% } %> -
    -
    - - - - - - - - - - - <% - numRegionsRendered = 0; - for (Map.Entry hriEntry : entryList) { - RegionInfo regionInfo = hriEntry.getKey(); - ServerName addr = regionsToServer.get(regionInfo); - RegionMetrics load = hriEntry.getValue(); - float locality = 0.0f; - float localityForSsd = 0.0f; - String state = "N/A"; - if (load != null) { - locality = load.getDataLocality(); - localityForSsd = load.getDataLocalityForSsd(); - } - if (addr != null) { - // This port might be wrong if RS actually ended up using something else. - urlRegionServer = - "//" + URLEncoder.encode(addr.getHostname()) + ":" + master.getRegionServerInfoPort(addr) + "/rs-status"; - } - if (numRegionsRendered < numRegionsToRender) { - numRegionsRendered++; - %> - - - <% - if (urlRegionServer != null) { - %> - - <% - } else { - %> - - <% + double rSize = load.getStoreFileSize().get(Size.Unit.BYTE); + if (rSize > 0) { + regionSize = StringUtils.byteDesc((long)rSize); } - %> - - - - <% } %> - <% } %> - -
    Name(<%= String.format("%,1d", regions.size())%>)Region ServerLocality
    (<%= totalLocality %>)
    LocalityForSsd
    (<%= totalLocalityForSsd %>)
    <%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %> - <%= addr == null? "-": StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + ":" + master.getRegionServerInfoPort(addr) %> - not deployed<%= locality%><%= localityForSsd%>
    -
    -
    - - - - - - - - - - - - - <% - numRegionsRendered = 0; - for (Map.Entry hriEntry : entryList) { - RegionInfo regionInfo = hriEntry.getKey(); - ServerName addr = regionsToServer.get(regionInfo); - RegionMetrics load = hriEntry.getValue(); - long compactingCells = 0; - long compactedCells = 0; - String compactionProgress = ""; - if (load != null) { - compactingCells = load.getCompactingCellCount(); - compactedCells = load.getCompactedCellCount(); - if (compactingCells > 0) { - compactionProgress = String.format("%.2f", 100 * ((float) - compactedCells / compactingCells)) + "%"; - } - } - if (addr != null) { - // This port might be wrong if RS actually ended up using something else. - urlRegionServer = - "//" + URLEncoder.encode(addr.getHostname()) + ":" + master.getRegionServerInfoPort(addr) + "/rs-status"; - } - if (numRegionsRendered < numRegionsToRender) { - numRegionsRendered++; - %> - - - <% - if (urlRegionServer != null) { - %> - - <% - } else { - %> - - <% + fileCount = String.format("%,1d", load.getStoreFileCount()); + double mSize = load.getMemStoreSize().get(Size.Unit.BYTE); + if (mSize > 0) { + memSize = StringUtils.byteDesc((long)mSize); + } + } + + if (stateMap.containsKey(regionInfo.getEncodedName())) { + state = stateMap.get(regionInfo.getEncodedName()).toString(); + } + + if (addr != null) { + ServerMetrics sl = master.getServerManager().getLoad(addr); + if(sl != null) { + Integer i = regDistribution.get(addr); + if (null == i) i = Integer.valueOf(0); + regDistribution.put(addr, i + 1); + if (RegionReplicaUtil.isDefaultReplica(regionInfo.getReplicaId())) { + i = primaryRegDistribution.get(addr); + if (null == i) i = Integer.valueOf(0); + primaryRegDistribution.put(addr, i+1); } - %> - - - - - - <% } %> - <% } %> - -
    Name(<%= String.format("%,1d", regions.size())%>)Region ServerNum. Compacting Cells
    (<%= String.format("%,1d", totalCompactingCells)%>)
    Num. Compacted Cells
    (<%= String.format("%,1d", totalCompactedCells)%>)
    Remaining Cells
    (<%= String.format("%,1d", totalCompactingCells-totalCompactedCells)%>)
    Compaction Progress
    (<%= totalCompactionProgress %>)
    <%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %> - <%= addr == null? "-": StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + ":" + master.getRegionServerInfoPort(addr) %> - not deployed<%= String.format("%,1d", compactingCells)%><%= String.format("%,1d", compactedCells)%><%= String.format("%,1d", compactingCells - compactedCells)%><%= compactionProgress%>
    - <% if (numRegions > numRegionsRendered) { - String allRegionsUrl = "?name=" + URLEncoder.encode(fqtn,"UTF-8") + "&numRegions=all"; - %> -

    This table has <%= numRegions %> regions in total, in order to improve the page load time, - only <%= numRegionsRendered %> regions are displayed here, click - here to see all regions.

    - <% } %> -
    -
    + } + } + if (numRegionsRendered < numRegionsToRender) { + numRegionsRendered++; + %> + + <%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %> + <%= buildRegionDeployedServerTag(regionInfo, master, regionsToServer) %> + <%= readReq%> + <%= writeReq%> + <%= regionSizeUncompressed%> + <%= regionSize%> + <%= fileCount%> + <%= memSize%> + <%= escapeXml(Bytes.toStringBinary(regionInfo.getStartKey()))%> + <%= escapeXml(Bytes.toStringBinary(regionInfo.getEndKey()))%> + <%= state%> + <%= regionInfo.getReplicaId() %> + + <% } %> + <% } %> + + + <%= moreRegionsToRender(numRegionsRendered, numRegions, fqtn) %>
    -

    Regions by Region Server

    - <% - if (withReplica) { - %> - - <% -} else { -%> -
    Region ServerRegion CountPrimary Region Count
    +
    +
    Region ServerRegion Count
    + + + + + + + + <% - } + numRegionsRendered = 0; + for (Map.Entry hriEntry : entryList) { + RegionInfo regionInfo = hriEntry.getKey(); + ServerName addr = regionsToServer.get(regionInfo); + RegionMetrics load = hriEntry.getValue(); + float locality = 0.0f; + float localityForSsd = 0.0f; + String state = "N/A"; + if (load != null) { + locality = load.getDataLocality(); + localityForSsd = load.getDataLocalityForSsd(); + } + + if (numRegionsRendered < numRegionsToRender) { + numRegionsRendered++; %> + + + <%= buildRegionDeployedServerTag(regionInfo, master, regionsToServer) %> + + + + <% } %> + <% } %> + +
    Name(<%= String.format("%,1d", regions.size())%>)Region ServerLocality
    (<%= totalLocality %>)
    LocalityForSsd
    (<%= totalLocalityForSsd %>)
    <%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %><%= locality%><%= localityForSsd%>
    + <%= moreRegionsToRender(numRegionsRendered, numRegions, fqtn) %> + +
    + + + + + + + + + + + + <% - for (Map.Entry rdEntry : regDistribution.entrySet()) { - ServerName addr = rdEntry.getKey(); - String url = "//" + URLEncoder.encode(addr.getHostname()) + ":" + master.getRegionServerInfoPort(addr) + "/rs-status"; + numRegionsRendered = 0; + for (Map.Entry hriEntry : entryList) { + RegionInfo regionInfo = hriEntry.getKey(); + ServerName addr = regionsToServer.get(regionInfo); + RegionMetrics load = hriEntry.getValue(); + long compactingCells = 0; + long compactedCells = 0; + String compactionProgress = ""; + if (load != null) { + compactingCells = load.getCompactingCellCount(); + compactedCells = load.getCompactedCellCount(); + if (compactingCells > 0) { + compactionProgress = String.format("%.2f", 100 * ((float) + compactedCells / compactingCells)) + "%"; + } + } + + if (numRegionsRendered < numRegionsToRender) { + numRegionsRendered++; %> - - - <% - if (withReplica) { - %> - - <% - } - %> + + <%= buildRegionDeployedServerTag(regionInfo, master, regionsToServer) %> + + + + <% } %> + <% } %>
    Name(<%= String.format("%,1d", regions.size())%>)Region ServerNum. Compacting Cells
    (<%= String.format("%,1d", totalCompactingCells)%>)
    Num. Compacted Cells
    (<%= String.format("%,1d", totalCompactedCells)%>)
    Remaining Cells
    (<%= String.format("%,1d", totalCompactingCells-totalCompactedCells)%>)
    Compaction Progress
    (<%= totalCompactionProgress %>)
    <%= StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + ":" + master.getRegionServerInfoPort(addr) %><%= rdEntry.getValue()%><%= primaryRegDistribution.get(addr)%><%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %><%= String.format("%,1d", compactingCells)%><%= String.format("%,1d", compactedCells)%><%= String.format("%,1d", compactingCells - compactedCells)%><%= compactionProgress%>
    - <% } + <%= moreRegionsToRender(numRegionsRendered, numRegions, fqtn) %> +
    + + + +

    Regions by Region Server

    + + + + + + + + + <% + for (Map.Entry rdEntry : regDistribution.entrySet()) { + ServerName addr = rdEntry.getKey(); + String url = "//" + URLEncoder.encode(addr.getHostname()) + ":" + + master.getRegionServerInfoPort(addr) + "/rs-status"; + %> + + + + + + <% } %> + +
    Region ServerRegion CountPrimary Region Count
    <%= StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + + ":" + master.getRegionServerInfoPort(addr) %><%= rdEntry.getValue()%><%= primaryRegDistribution.get(addr) == null ? 0 : primaryRegDistribution.get(addr)%>
    + +<% } } catch(Exception ex) { %> Unknown Issue with Regions
    @@ -1182,105 +1183,87 @@ - <% if (!readOnly) { %> -


    - Actions: -

    -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - This action will force a compaction of all regions of the table, or, - if a key is supplied, only the region containing the - given key. -
    - - - - - This action will force a split of all eligible - regions of the table, or, if a key is supplied, only the region containing the - given key. An eligible region is one that does not contain any references to - other regions. Split requests for noneligible regions will be ignored. -
    - - - - - - This action will merge two regions of the table, Merge requests for - noneligible regions will be ignored. -
    -
    -

    - <% } %> -
    +<% if (!readOnly) { %> +


    +Actions: +

    +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + This action will force a major compaction of all regions of the table, or, + if a key is supplied, only the region major containing the + given key. +
    + + + + + This action will force a compaction of all regions of the table, or, + if a key is supplied, only the region containing the + given key. +
    + + + + + This action will force a split of all eligible + regions of the table, or, if a key is supplied, only the region containing the + given key. An eligible region is one that does not contain any references to + other regions. Split requests for noneligible regions will be ignored. +
    + + + + + + This action will merge two regions of the table, Merge requests for + noneligible regions will be ignored. +
    +
    +

    +<% } %> -<% } -} catch(TableNotFoundException e) { %> -
    -
    - -
    -


    -

    Go Back -

    <% -} catch(IllegalArgumentException e) { %> -
    -
    - -
    -


    -

    Go Back -

    <% - } -} -else { // handle the case for fqtn is null or master is not initialized with error message + redirect -%> -
    -
    - -
    -


    -

    -<% } %> @@ -1288,78 +1271,94 @@ else { // handle the case for fqtn is null or master is not initialized with err diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/header.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/header.jsp index edbecc424c62..1c5318b19b94 100644 --- a/hbase-server/src/main/resources/hbase-webapps/regionserver/header.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/header.jsp @@ -56,7 +56,17 @@
  • Operation Details
  • Log Level
  • Debug Dump
  • -
  • Metrics Dump
  • +
  • Profiler
  • <% if (HBaseConfiguration.isShowConfInServlet()) { %>
  • HBase Configuration
  • diff --git a/hbase-thrift/src/main/resources/hbase-webapps/thrift/footer.jsp b/hbase-thrift/src/main/resources/hbase-webapps/thrift/footer.jsp new file mode 100644 index 000000000000..53a7d0cdbdbb --- /dev/null +++ b/hbase-thrift/src/main/resources/hbase-webapps/thrift/footer.jsp @@ -0,0 +1,30 @@ +<%-- +/** +* 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. +*/ +--%> + + + + + + diff --git a/hbase-thrift/src/main/resources/hbase-webapps/thrift/header.jsp b/hbase-thrift/src/main/resources/hbase-webapps/thrift/header.jsp new file mode 100644 index 000000000000..f43872c11af6 --- /dev/null +++ b/hbase-thrift/src/main/resources/hbase-webapps/thrift/header.jsp @@ -0,0 +1,74 @@ +<%-- +/** +* 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="org.apache.hadoop.hbase.HBaseConfiguration"%> + + + + + + + <%= request.getParameter("pageTitle")%> + + + + + + + + + + diff --git a/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp b/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp index cb22007bea6f..d148df1f2e29 100644 --- a/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp +++ b/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp @@ -19,7 +19,6 @@ --%> <%@ page contentType="text/html;charset=UTF-8" import="org.apache.hadoop.conf.Configuration" - import="org.apache.hadoop.hbase.HBaseConfiguration" import="org.apache.hadoop.hbase.util.VersionInfo" import="java.util.Date" %> @@ -27,54 +26,25 @@ <%@ page import="org.apache.hadoop.hbase.util.JvmVersion" %> <% -Configuration conf = (Configuration)getServletContext().getAttribute("hbase.conf"); -String serverType = (String)getServletContext().getAttribute("hbase.thrift.server.type"); -long startcode = conf.getLong("startcode", System.currentTimeMillis()); -String listenPort = conf.get("hbase.regionserver.thrift.port", "9090"); -ImplType implType = ImplType.getServerImpl(conf); -String framed = implType.isAlwaysFramed() - ? "true" : conf.get("hbase.regionserver.thrift.framed", "false"); -String compact = conf.get("hbase.regionserver.thrift.compact", "false"); -%> - - - - - - HBase Thrift Server: <%= listenPort %> - - + Configuration conf = (Configuration)getServletContext().getAttribute("hbase.conf"); + String serverType = (String)getServletContext().getAttribute("hbase.thrift.server.type"); + long startcode = conf.getLong("startcode", System.currentTimeMillis()); + String listenPort = conf.get("hbase.regionserver.thrift.port", "9090"); + ImplType implType = ImplType.getServerImpl(conf); + + String transport = + (implType.isAlwaysFramed() || + conf.getBoolean("hbase.regionserver.thrift.framed", false)) ? "Framed" : "Standard"; + String protocol = + conf.getBoolean("hbase.regionserver.thrift.compact", false) ? "Compact" : "Binary"; + String qop = conf.get("hbase.thrift.security.qop", "None"); - - - - + pageContext.setAttribute("pageTitle", "HBase Thrift Server: " + listenPort); +%> - - + + +
    @@ -118,31 +88,34 @@ String compact = conf.get("hbase.regionserver.thrift.compact", "false"); Thrift RPC engine implementation type chosen by this Thrift server - Compact Protocol - <%= compact %> - Thrift RPC engine uses compact protocol + Protocol + <%= protocol %> + Thrift RPC engine protocol type - Framed Transport - <%= framed %> - Thrift RPC engine uses framed transport + Transport + <%= transport %> + Thrift RPC engine transport type Thrift Server Type <%= serverType %> The type of this Thrift server + + Quality of Protection + <%= qop %> + QOP Settings for SASL +
    - - - - - + +