HBASE-24624 Optimize table.jsp code (#1963)

Signed-off-by: Guangxu Cheng <gxcheng@apache.org>
This commit is contained in:
xincunSong 2020-07-01 08:49:51 +08:00 committed by GitHub
parent 8c4d7618b7
commit 9ad16aa376
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 161 additions and 230 deletions

View File

@ -87,7 +87,7 @@
* its region server. * its region server.
* @return an anchor tag if one can be built, {@code null} otherwise. * @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) { final RegionInfo regionInfo, final RegionState.State regionState) {
if (serverName == null || regionInfo == null) { return null; } if (serverName == null || regionInfo == null) { return null; }
@ -101,6 +101,45 @@
+ "?name=" + regionInfo.getEncodedName(); + "?name=" + regionInfo.getEncodedName();
return "<a href=\"" + URI + "\">" + serverName.getServerName() + "</a>"; return "<a href=\"" + URI + "\">" + serverName.getServerName() + "</a>";
} }
/**
* Render an <td> tag contents server name which the given region deploys.
* Links to the server rs-status page.
* <td class="undeployed-region">not deployed</td> instead if can not find the deploy message.
* @return an <td> tag contents server name links to server rs-status page.
*/
private static String buildRegionDeployedServerTag(RegionInfo regionInfo, HMaster master,
Map<RegionInfo, ServerName> regionsToServer) {
ServerName serverName = regionsToServer.get(regionInfo);
if (serverName == null) {
return "<td class=\"undeployed-region\">not deployed</td>";
}
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 "<td><a href=\"" + urlRegionServer + "\">" + StringEscapeUtils.escapeHtml4(hostName)
+ ":" + serverInfoPort + "</a></td>";
}
/**
* @return an <p> 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 <b>" + numRegions
+ "</b> regions in total, in order to improve the page load time, only <b>"
+ numRegionsRendered + "</b> regions are displayed here, <a href=\""
+ allRegionsUrl + "\">click here</a> to see all regions.</p>";
}
return "";
}
%> %>
<% <%
final String ZEROMB = "0 MB"; final String ZEROMB = "0 MB";
@ -108,8 +147,7 @@
Configuration conf = master.getConfiguration(); Configuration conf = master.getConfiguration();
String fqtn = request.getParameter("name"); String fqtn = request.getParameter("name");
final String escaped_fqtn = StringEscapeUtils.escapeHtml4(fqtn); final String escaped_fqtn = StringEscapeUtils.escapeHtml4(fqtn);
Table table; Table table = master.getConnection().getTable(TableName.valueOf(fqtn));
boolean withReplica = false;
boolean showFragmentation = conf.getBoolean("hbase.master.ui.fragmentation.enabled", false); boolean showFragmentation = conf.getBoolean("hbase.master.ui.fragmentation.enabled", false);
boolean readOnly = !InfoServer.canUserModifyUI(request, getServletContext(), conf); boolean readOnly = !InfoServer.canUserModifyUI(request, getServletContext(), conf);
int numMetaReplicas = conf.getInt(HConstants.META_REPLICAS_NUM, int numMetaReplicas = conf.getInt(HConstants.META_REPLICAS_NUM,
@ -160,31 +198,50 @@
<jsp:param name="pageTitle" value="${pageTitle}"/> <jsp:param name="pageTitle" value="${pageTitle}"/>
</jsp:include> </jsp:include>
<% <% // handle the case for fqtn is null or master is not initialized with error message + redirect
if (fqtn != null && master.isInitialized()) { if (fqtn == null || ! master.isInitialized()) { %>
try { <div class="container-fluid content">
table = master.getConnection().getTable(TableName.valueOf(fqtn)); <div class="row inner_header">
if (table.getDescriptor().getRegionReplication() > 1) { <div class="page-header">
withReplica = true; <h1>Table not ready</h1>
}
if ( !readOnly && action != null ) {
%>
<div class="container-fluid content">
<div class="row inner_header">
<div class="page-header">
<h1>Table action request accepted</h1>
</div>
</div> </div>
<p><hr><p> </div>
<% <p><hr><p>
if (action.equals("split")) { <jsp:include page="redirect.jsp" />
</div>
<% return;
} %>
<% // unknow table
if (! admin.tableExists(TableName.valueOf(fqtn)).get()) { %>
<div class="container-fluid content">
<div class="row inner_header">
<div class="page-header">
<h1>Table not found</h1>
</div>
</div>
<p><hr><p>
<jsp:include page="redirect.jsp" />
</div>
<% return;
} %>
<% // table split/compact/merge actions
if ( !readOnly && action != null ) { %>
<div class="container-fluid content">
<div class="row inner_header">
<div class="page-header">
<h1>Table action request accepted</h1>
</div>
</div>
<p><hr><p>
<% if (action.equals("split")) {
if (key != null && key.length() > 0) { if (key != null && key.length() > 0) {
admin.split(TableName.valueOf(fqtn), Bytes.toBytes(key)); admin.split(TableName.valueOf(fqtn), Bytes.toBytes(key));
} else { } else {
admin.split(TableName.valueOf(fqtn)); admin.split(TableName.valueOf(fqtn));
} }
%> Split request accepted. <%
%> Split request accepted. <%
} else if (action.equals("compact")) { } else if (action.equals("compact")) {
if (key != null && key.length() > 0) { if (key != null && key.length() > 0) {
List<RegionInfo> regions = admin.getRegions(TableName.valueOf(fqtn)).get(); List<RegionInfo> regions = admin.getRegions(TableName.valueOf(fqtn)).get();
@ -198,45 +255,39 @@ if (fqtn != null && master.isInitialized()) {
} else { } else {
admin.compact(TableName.valueOf(fqtn)); admin.compact(TableName.valueOf(fqtn));
} }
%> Compact request accepted. <% %> Compact request accepted. <%
} else if (action.equals("merge")) { } else if (action.equals("merge")) {
if (left != null && left.length() > 0 && right != null && right.length() > 0) { if (left != null && left.length() > 0 && right != null && right.length() > 0) {
admin.mergeRegions(Bytes.toBytesBinary(left), Bytes.toBytesBinary(right), false); admin.mergeRegions(Bytes.toBytesBinary(left), Bytes.toBytesBinary(right), false);
} }
%> Merge request accepted. <% %> Merge request accepted. <%
} } %>
%> <jsp:include page="redirect.jsp" />
<jsp:include page="redirect.jsp" />
</div>
<%
} else {
%>
<div class="container-fluid content">
<div class="row inner_header">
<div class="page-header">
<h1>Table <small><%= escaped_fqtn %></small></h1>
</div>
</div> </div>
<div class="row"> <% return;
<% } %>
if(fqtn.equals(TableName.META_TABLE_NAME.getNameAsString())) {
%> <div class="container-fluid content">
<div class="row inner_header">
<div class="page-header">
<h1>Table <small><%= escaped_fqtn %></small></h1>
</div>
</div>
<div class="row">
<% //Meta table.
if(fqtn.equals(TableName.META_TABLE_NAME.getNameAsString())) { %>
<h2>Table Regions</h2> <h2>Table Regions</h2>
<div class="tabbable"> <div class="tabbable">
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<li class="active"> <li class="active"><a href="#metaTab_baseStats" data-toggle="tab">Base Stats</a></li>
<a href="#metaTab_baseStats" data-toggle="tab">Base Stats</a> <li class=""><a href="#metaTab_localityStats" data-toggle="tab">Localities</a></li>
</li> <li class=""><a href="#metaTab_compactStats" data-toggle="tab">Compactions</a></li>
<li class="">
<a href="#metaTab_localityStats" data-toggle="tab">Localities</a>
</li>
<li class="">
<a href="#metaTab_compactStats" data-toggle="tab">Compactions</a>
</li>
</ul> </ul>
<div class="tab-content" style="padding-bottom: 9px; border-bottom: 1px solid #ddd;"> <div class="tab-content" style="padding-bottom: 9px; border-bottom: 1px solid #ddd;">
<div class="tab-pane active" id="metaTab_baseStats"> <div class="tab-pane active" id="metaTab_baseStats">
<table id="tableRegionTable" class="tablesorter table table-striped"> <table id="metaTableBaseStatsTable" class="tablesorter table table-striped">
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
@ -248,13 +299,7 @@ if (fqtn != null && master.isInitialized()) {
<th>MemSize</th> <th>MemSize</th>
<th>Start Key</th> <th>Start Key</th>
<th>End Key</th> <th>End Key</th>
<%
if (withReplica) {
%>
<th>ReplicaID</th> <th>ReplicaID</th>
<%
}
%>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -305,13 +350,7 @@ if (fqtn != null && master.isInitialized()) {
<td><%= memSize%></td> <td><%= memSize%></td>
<td><%= escapeXml(Bytes.toString(meta.getStartKey())) %></td> <td><%= escapeXml(Bytes.toString(meta.getStartKey())) %></td>
<td><%= escapeXml(Bytes.toString(meta.getEndKey())) %></td> <td><%= escapeXml(Bytes.toString(meta.getEndKey())) %></td>
<%
if (withReplica) {
%>
<td><%= meta.getReplicaId() %></td> <td><%= meta.getReplicaId() %></td>
<%
}
%>
</tr> </tr>
<% } %> <% } %>
<%} %> <%} %>
@ -319,7 +358,7 @@ if (fqtn != null && master.isInitialized()) {
</table> </table>
</div> </div>
<div class="tab-pane" id="metaTab_localityStats"> <div class="tab-pane" id="metaTab_localityStats">
<table id="tableRegionTable" class="tablesorter table table-striped"> <table id="metaTableLocalityStatsTable" class="tablesorter table table-striped">
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
@ -421,6 +460,7 @@ if (fqtn != null && master.isInitialized()) {
</div> </div>
</div> </div>
</div> </div>
<h2 id="meta-entries">Meta Entries</h2> <h2 id="meta-entries">Meta Entries</h2>
<% <%
if (!metaBrowser.getErrorMessages().isEmpty()) { if (!metaBrowser.getErrorMessages().isEmpty()) {
@ -512,7 +552,7 @@ if (fqtn != null && master.isInitialized()) {
<td title="endKey"><%= endKeyDisplay %></td> <td title="endKey"><%= endKeyDisplay %></td>
<td title="replicaId"><%= replicaIdDisplay %></td> <td title="replicaId"><%= replicaIdDisplay %></td>
<td title="regionState"><%= regionStateDisplay %></td> <td title="regionState"><%= regionStateDisplay %></td>
<td title="<%= serverColumnName + "," + startCodeColumnName %>"><%= buildRegionServerLink(serverName, rsPort, regionInfo, regionState) %></td> <td title="<%= serverColumnName + "," + startCodeColumnName %>"><%= buildRegionLink(serverName, rsPort, regionInfo, regionState) %></td>
<td title="<%= seqNumColumnName %>"><%= seqNum %></td> <td title="<%= seqNumColumnName %>"><%= seqNum %></td>
<td title="<%= serverNameColumnName %>"><%= targetServerName %></td> <td title="<%= serverNameColumnName %>"><%= targetServerName %></td>
<td><%= mergeRegionNames %></td> <td><%= mergeRegionNames %></td>
@ -581,6 +621,7 @@ if (fqtn != null && master.isInitialized()) {
</div> </div>
</div> </div>
<%} else { <%} else {
//Common tables
RegionStates states = master.getAssignmentManager().getRegionStates(); RegionStates states = master.getAssignmentManager().getRegionStates();
Map<RegionState.State, List<RegionInfo>> regionStates = states.getRegionByStateOfTable(table.getName()); Map<RegionState.State, List<RegionInfo>> regionStates = states.getRegionByStateOfTable(table.getName());
Map<String, RegionState.State> stateMap = new HashMap<>(); Map<String, RegionState.State> stateMap = new HashMap<>();
@ -590,7 +631,9 @@ if (fqtn != null && master.isInitialized()) {
} }
} }
RegionLocator r = master.getConnection().getRegionLocator(table.getName()); RegionLocator r = master.getConnection().getRegionLocator(table.getName());
try { %>
try {
%>
<h2>Table Attributes</h2> <h2>Table Attributes</h2>
<table class="table table-striped"> <table class="table table-striped">
<tr> <tr>
@ -820,19 +863,13 @@ if (fqtn != null && master.isInitialized()) {
<h2>Table Regions</h2> <h2>Table Regions</h2>
<div class="tabbable"> <div class="tabbable">
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<li class="active"> <li class="active"><a href="#tab_baseStats" data-toggle="tab">Base Stats</a></li>
<a href="#tab_baseStats" data-toggle="tab">Base Stats</a> <li class=""><a href="#tab_localityStats" data-toggle="tab">Localities</a></li>
</li> <li class=""><a href="#tab_compactStats" data-toggle="tab">Compactions</a></li>
<li class="">
<a href="#tab_localityStats" data-toggle="tab">Localities</a>
</li>
<li class="">
<a href="#tab_compactStats" data-toggle="tab">Compactions</a>
</li>
</ul> </ul>
<div class="tab-content" style="padding-bottom: 9px; border-bottom: 1px solid #ddd;"> <div class="tab-content" style="padding-bottom: 9px; border-bottom: 1px solid #ddd;">
<div class="tab-pane active" id="tab_baseStats"> <div class="tab-pane active" id="tab_baseStats">
<table id="regionServerDetailsTable" class="tablesorter table table-striped"> <table id="tableBaseStatsTable" class="tablesorter table table-striped">
<thead> <thead>
<tr> <tr>
<th>Name(<%= String.format("%,1d", regions.size())%>)</th> <th>Name(<%= String.format("%,1d", regions.size())%>)</th>
@ -845,13 +882,7 @@ if (fqtn != null && master.isInitialized()) {
<th>Start Key</th> <th>Start Key</th>
<th>End Key</th> <th>End Key</th>
<th>Region State</th> <th>Region State</th>
<%
if (withReplica) {
%>
<th>ReplicaID</th> <th>ReplicaID</th>
<%
}
%>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -867,7 +898,6 @@ if (fqtn != null && master.isInitialized()) {
RegionInfo regionInfo = hriEntry.getKey(); RegionInfo regionInfo = hriEntry.getKey();
ServerName addr = regionsToServer.get(regionInfo); ServerName addr = regionsToServer.get(regionInfo);
RegionMetrics load = hriEntry.getValue(); RegionMetrics load = hriEntry.getValue();
String urlRegionServer = null;
String readReq = "N/A"; String readReq = "N/A";
String writeReq = "N/A"; String writeReq = "N/A";
String regionSize = ZEROMB; String regionSize = ZEROMB;
@ -894,14 +924,11 @@ if (fqtn != null && master.isInitialized()) {
if (addr != null) { if (addr != null) {
ServerMetrics sl = master.getServerManager().getLoad(addr); 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) { if(sl != null) {
Integer i = regDistribution.get(addr); Integer i = regDistribution.get(addr);
if (null == i) i = Integer.valueOf(0); if (null == i) i = Integer.valueOf(0);
regDistribution.put(addr, i + 1); regDistribution.put(addr, i + 1);
if (withReplica && RegionReplicaUtil.isDefaultReplica(regionInfo.getReplicaId())) { if (RegionReplicaUtil.isDefaultReplica(regionInfo.getReplicaId())) {
i = primaryRegDistribution.get(addr); i = primaryRegDistribution.get(addr);
if (null == i) i = Integer.valueOf(0); if (null == i) i = Integer.valueOf(0);
primaryRegDistribution.put(addr, i+1); primaryRegDistribution.put(addr, i+1);
@ -913,19 +940,7 @@ if (fqtn != null && master.isInitialized()) {
%> %>
<tr> <tr>
<td><%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %></td> <td><%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %></td>
<% <%= buildRegionDeployedServerTag(regionInfo, master, regionsToServer) %>
if (urlRegionServer != null) {
%>
<td>
<a href="<%= urlRegionServer %>"><%= addr == null? "-": StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + ":" + master.getRegionServerInfoPort(addr) %></a>
</td>
<%
} else {
%>
<td class="undeployed-region">not deployed</td>
<%
}
%>
<td><%= readReq%></td> <td><%= readReq%></td>
<td><%= writeReq%></td> <td><%= writeReq%></td>
<td><%= regionSize%></td> <td><%= regionSize%></td>
@ -934,28 +949,16 @@ if (fqtn != null && master.isInitialized()) {
<td><%= escapeXml(Bytes.toStringBinary(regionInfo.getStartKey()))%></td> <td><%= escapeXml(Bytes.toStringBinary(regionInfo.getStartKey()))%></td>
<td><%= escapeXml(Bytes.toStringBinary(regionInfo.getEndKey()))%></td> <td><%= escapeXml(Bytes.toStringBinary(regionInfo.getEndKey()))%></td>
<td><%= state%></td> <td><%= state%></td>
<%
if (withReplica) {
%>
<td><%= regionInfo.getReplicaId() %></td> <td><%= regionInfo.getReplicaId() %></td>
<%
}
%>
</tr> </tr>
<% } %> <% } %>
<% } %> <% } %>
</tbody> </tbody>
</table> </table>
<% if (numRegions > numRegionsRendered) { <%= moreRegionsToRender(numRegionsRendered, numRegions, fqtn) %>
String allRegionsUrl = "?name=" + URLEncoder.encode(fqtn,"UTF-8") + "&numRegions=all";
%>
<p>This table has <b><%= numRegions %></b> regions in total, in order to improve the page load time,
only <b><%= numRegionsRendered %></b> regions are displayed here, <a href="<%= allRegionsUrl %>">click
here</a> to see all regions.</p>
<% } %>
</div> </div>
<div class="tab-pane" id="tab_localityStats"> <div class="tab-pane" id="tab_localityStats">
<table id="regionServerDetailsTable" class="tablesorter table table-striped"> <table id="tableLocalityStatsTable" class="tablesorter table table-striped">
<thead> <thead>
<tr> <tr>
<th>Name(<%= String.format("%,1d", regions.size())%>)</th> <th>Name(<%= String.format("%,1d", regions.size())%>)</th>
@ -971,7 +974,6 @@ if (fqtn != null && master.isInitialized()) {
RegionInfo regionInfo = hriEntry.getKey(); RegionInfo regionInfo = hriEntry.getKey();
ServerName addr = regionsToServer.get(regionInfo); ServerName addr = regionsToServer.get(regionInfo);
RegionMetrics load = hriEntry.getValue(); RegionMetrics load = hriEntry.getValue();
String urlRegionServer = null;
float locality = 0.0f; float locality = 0.0f;
float localityForSsd = 0.0f; float localityForSsd = 0.0f;
String state = "N/A"; String state = "N/A";
@ -980,30 +982,12 @@ if (fqtn != null && master.isInitialized()) {
localityForSsd = load.getDataLocalityForSsd(); 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) { if (numRegionsRendered < numRegionsToRender) {
numRegionsRendered++; numRegionsRendered++;
%> %>
<tr> <tr>
<td><%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %></td> <td><%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %></td>
<% <%= buildRegionDeployedServerTag(regionInfo, master, regionsToServer) %>
if (urlRegionServer != null) {
%>
<td>
<a href="<%= urlRegionServer %>"><%= addr == null? "-": StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + ":" + master.getRegionServerInfoPort(addr) %></a>
</td>
<%
} else {
%>
<td class="undeployed-region">not deployed</td>
<%
}
%>
<td><%= locality%></td> <td><%= locality%></td>
<td><%= localityForSsd%></td> <td><%= localityForSsd%></td>
</tr> </tr>
@ -1011,6 +995,7 @@ if (fqtn != null && master.isInitialized()) {
<% } %> <% } %>
</tbody> </tbody>
</table> </table>
<%= moreRegionsToRender(numRegionsRendered, numRegions, fqtn) %>
</div> </div>
<div class="tab-pane" id="tab_compactStats"> <div class="tab-pane" id="tab_compactStats">
<table id="tableCompactStatsTable" class="tablesorter table table-striped"> <table id="tableCompactStatsTable" class="tablesorter table table-striped">
@ -1031,7 +1016,6 @@ if (fqtn != null && master.isInitialized()) {
RegionInfo regionInfo = hriEntry.getKey(); RegionInfo regionInfo = hriEntry.getKey();
ServerName addr = regionsToServer.get(regionInfo); ServerName addr = regionsToServer.get(regionInfo);
RegionMetrics load = hriEntry.getValue(); RegionMetrics load = hriEntry.getValue();
String urlRegionServer = null;
long compactingCells = 0; long compactingCells = 0;
long compactedCells = 0; long compactedCells = 0;
String compactionProgress = ""; String compactionProgress = "";
@ -1044,30 +1028,12 @@ if (fqtn != null && master.isInitialized()) {
} }
} }
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) { if (numRegionsRendered < numRegionsToRender) {
numRegionsRendered++; numRegionsRendered++;
%> %>
<tr> <tr>
<td><%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %></td> <td><%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %></td>
<% <%= buildRegionDeployedServerTag(regionInfo, master, regionsToServer) %>
if (urlRegionServer != null) {
%>
<td>
<a href="<%= urlRegionServer %>"><%= addr == null? "-": StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + ":" + master.getRegionServerInfoPort(addr) %></a>
</td>
<%
} else {
%>
<td class="undeployed-region">not deployed</td>
<%
}
%>
<td><%= String.format("%,1d", compactingCells)%></td> <td><%= String.format("%,1d", compactingCells)%></td>
<td><%= String.format("%,1d", compactedCells)%></td> <td><%= String.format("%,1d", compactedCells)%></td>
<td><%= String.format("%,1d", compactingCells - compactedCells)%></td> <td><%= String.format("%,1d", compactingCells - compactedCells)%></td>
@ -1077,48 +1043,36 @@ if (fqtn != null && master.isInitialized()) {
<% } %> <% } %>
</tbody> </tbody>
</table> </table>
<% if (numRegions > numRegionsRendered) { <%= moreRegionsToRender(numRegionsRendered, numRegions, fqtn) %>
String allRegionsUrl = "?name=" + URLEncoder.encode(fqtn,"UTF-8") + "&numRegions=all";
%>
<p>This table has <b><%= numRegions %></b> regions in total, in order to improve the page load time,
only <b><%= numRegionsRendered %></b> regions are displayed here, <a href="<%= allRegionsUrl %>">click
here</a> to see all regions.</p>
<% } %>
</div> </div>
</div> </div>
</div> </div>
<h2>Regions by Region Server</h2> <h2>Regions by Region Server</h2>
<% <table id="regionServerTable" class="tablesorter table table-striped">
if (withReplica) { <thead>
%> <tr>
<table id="regionServerTable" class="tablesorter table table-striped"><thead><tr><th>Region Server</th><th>Region Count</th><th>Primary Region Count</th></tr></thead> <th>Region Server</th><th>Region Count</th><th>Primary Region Count</th>
<% </tr>
} else { </thead>
%>
<table id="regionServerTable" class="tablesorter table table-striped"><thead><tr><th>Region Server</th><th>Region Count</th></tr></thead> <tbody>
<tbody> <%
<% for (Map.Entry<ServerName, Integer> rdEntry : regDistribution.entrySet()) {
} ServerName addr = rdEntry.getKey();
%> String url = "//" + URLEncoder.encode(addr.getHostname()) + ":"
<% + master.getRegionServerInfoPort(addr) + "/rs-status";
for (Map.Entry<ServerName, Integer> rdEntry : regDistribution.entrySet()) { %>
ServerName addr = rdEntry.getKey(); <tr>
String url = "//" + URLEncoder.encode(addr.getHostname()) + ":" + master.getRegionServerInfoPort(addr) + "/rs-status"; <td><a href="<%= url %>"><%= StringEscapeUtils.escapeHtml4(addr.getHostname().toString())
%> + ":" + master.getRegionServerInfoPort(addr) %></a></td>
<tr> <td><%= rdEntry.getValue()%></td>
<td><a href="<%= url %>"><%= StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + ":" + master.getRegionServerInfoPort(addr) %></a></td> <td><%= primaryRegDistribution.get(addr) == null ? 0 : primaryRegDistribution.get(addr)%></td>
<td><%= rdEntry.getValue()%></td> </tr>
<% <% } %>
if (withReplica) { </tbody>
%>
<td><%= primaryRegDistribution.get(addr)%></td>
<%
}
%>
</tr>
<% } %>
</tbody>
</table> </table>
<% } <% }
} catch(Exception ex) { } catch(Exception ex) {
for(StackTraceElement element : ex.getStackTrace()) { for(StackTraceElement element : ex.getStackTrace()) {
@ -1218,41 +1172,6 @@ Actions:
<% } %> <% } %>
</div> </div>
</div> </div>
<% }
} catch(TableNotFoundException e) { %>
<div class="container-fluid content">
<div class="row inner_header">
<div class="page-header">
<h1>Table not found</h1>
</div>
</div>
<p><hr><p>
<p>Go <a href="javascript:history.back()">Back</a>
</div> <%
} catch(IllegalArgumentException e) { %>
<div class="container-fluid content">
<div class="row inner_header">
<div class="page-header">
<h1>Table qualifier must not be empty</h1>
</div>
</div>
<p><hr><p>
<p>Go <a href="javascript:history.back()">Back</a>
</div> <%
}
}
else { // handle the case for fqtn is null or master is not initialized with error message + redirect
%>
<div class="container-fluid content">
<div class="row inner_header">
<div class="page-header">
<h1>Table not ready</h1>
</div>
</div>
<p><hr><p>
<jsp:include page="redirect.jsp" />
</div>
<% } %>
<jsp:include page="footer.jsp" /> <jsp:include page="footer.jsp" />
<script src="/static/js/jquery.min.js" type="text/javascript"></script> <script src="/static/js/jquery.min.js" type="text/javascript"></script>
@ -1300,7 +1219,7 @@ $(document).ready(function()
1: {sorter: 'separator'} 1: {sorter: 'separator'}
} }
}); });
$("#regionServerDetailsTable").tablesorter({ $("#tableBaseStatsTable").tablesorter({
headers: { headers: {
2: {sorter: 'separator'}, 2: {sorter: 'separator'},
3: {sorter: 'separator'}, 3: {sorter: 'separator'},
@ -1309,7 +1228,7 @@ $(document).ready(function()
6: {sorter: 'filesize'} 6: {sorter: 'filesize'}
} }
}); });
$("#tableRegionTable").tablesorter({ $("#metaTableBaseStatsTable").tablesorter({
headers: { headers: {
2: {sorter: 'separator'}, 2: {sorter: 'separator'},
3: {sorter: 'separator'}, 3: {sorter: 'separator'},
@ -1318,6 +1237,18 @@ $(document).ready(function()
6: {sorter: 'filesize'} 6: {sorter: 'filesize'}
} }
}); });
$("#tableLocalityStatsTable").tablesorter({
headers: {
2: {sorter: 'separator'},
3: {sorter: 'separator'}
}
});
$("#metaTableLocalityStatsTable").tablesorter({
headers: {
2: {sorter: 'separator'},
3: {sorter: 'separator'}
}
});
$("#tableCompactStatsTable").tablesorter({ $("#tableCompactStatsTable").tablesorter({
headers: { headers: {
2: {sorter: 'separator'}, 2: {sorter: 'separator'},