HBASE-22751 table.jsp fails if ugly regions in table
This commit is contained in:
parent
4a83de75c7
commit
8b1952a42a
|
@ -27,6 +27,7 @@
|
||||||
import="java.util.List"
|
import="java.util.List"
|
||||||
import="java.util.Map"
|
import="java.util.Map"
|
||||||
import="java.util.TreeMap"
|
import="java.util.TreeMap"
|
||||||
|
import=" java.util.concurrent.TimeUnit"
|
||||||
import="org.apache.commons.lang3.StringEscapeUtils"
|
import="org.apache.commons.lang3.StringEscapeUtils"
|
||||||
import="org.apache.hadoop.conf.Configuration"
|
import="org.apache.hadoop.conf.Configuration"
|
||||||
import="org.apache.hadoop.hbase.HColumnDescriptor"
|
import="org.apache.hadoop.hbase.HColumnDescriptor"
|
||||||
|
@ -35,8 +36,10 @@
|
||||||
import="org.apache.hadoop.hbase.ServerName"
|
import="org.apache.hadoop.hbase.ServerName"
|
||||||
import="org.apache.hadoop.hbase.TableName"
|
import="org.apache.hadoop.hbase.TableName"
|
||||||
import="org.apache.hadoop.hbase.TableNotFoundException"
|
import="org.apache.hadoop.hbase.TableNotFoundException"
|
||||||
import="org.apache.hadoop.hbase.client.Admin"
|
import="org.apache.hadoop.hbase.client.AsyncAdmin"
|
||||||
|
import="org.apache.hadoop.hbase.client.AsyncConnection"
|
||||||
import="org.apache.hadoop.hbase.client.CompactionState"
|
import="org.apache.hadoop.hbase.client.CompactionState"
|
||||||
|
import="org.apache.hadoop.hbase.client.ConnectionFactory"
|
||||||
import="org.apache.hadoop.hbase.client.RegionInfo"
|
import="org.apache.hadoop.hbase.client.RegionInfo"
|
||||||
import="org.apache.hadoop.hbase.client.RegionInfoBuilder"
|
import="org.apache.hadoop.hbase.client.RegionInfoBuilder"
|
||||||
import="org.apache.hadoop.hbase.client.RegionLocator"
|
import="org.apache.hadoop.hbase.client.RegionLocator"
|
||||||
|
@ -117,6 +120,8 @@
|
||||||
pageTitle = "Table: " + escaped_fqtn;
|
pageTitle = "Table: " + escaped_fqtn;
|
||||||
}
|
}
|
||||||
pageContext.setAttribute("pageTitle", pageTitle);
|
pageContext.setAttribute("pageTitle", pageTitle);
|
||||||
|
AsyncConnection connection = ConnectionFactory.createAsyncConnection(master.getConfiguration()).get();
|
||||||
|
AsyncAdmin admin = connection.getAdminBuilder().setOperationTimeout(5, TimeUnit.SECONDS).build();
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<jsp:include page="header.jsp">
|
<jsp:include page="header.jsp">
|
||||||
|
@ -143,7 +148,6 @@ if (fqtn != null && master.isInitialized()) {
|
||||||
</div>
|
</div>
|
||||||
<p><hr><p>
|
<p><hr><p>
|
||||||
<%
|
<%
|
||||||
try (Admin admin = master.getConnection().getAdmin()) {
|
|
||||||
if (action.equals("split")) {
|
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));
|
||||||
|
@ -154,7 +158,7 @@ if (fqtn != null && master.isInitialized()) {
|
||||||
%> 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));
|
List<RegionInfo> regions = admin.getRegions(TableName.valueOf(fqtn)).get();
|
||||||
byte[] row = Bytes.toBytes(key);
|
byte[] row = Bytes.toBytes(key);
|
||||||
|
|
||||||
for (RegionInfo region : regions) {
|
for (RegionInfo region : regions) {
|
||||||
|
@ -172,7 +176,6 @@ if (fqtn != null && master.isInitialized()) {
|
||||||
}
|
}
|
||||||
%> Merge request accepted. <%
|
%> Merge request accepted. <%
|
||||||
}
|
}
|
||||||
}
|
|
||||||
%>
|
%>
|
||||||
<jsp:include page="redirect.jsp" />
|
<jsp:include page="redirect.jsp" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -260,7 +263,7 @@ if (fqtn != null && master.isInitialized()) {
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Enabled</td>
|
<td>Enabled</td>
|
||||||
<td><%= admin.isTableEnabled(table.getName()) %></td>
|
<td><%= admin.isTableEnabled(table.getName()).get() %></td>
|
||||||
<td>Is the table enabled</td>
|
<td>Is the table enabled</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -268,7 +271,7 @@ if (fqtn != null && master.isInitialized()) {
|
||||||
<td>
|
<td>
|
||||||
<%
|
<%
|
||||||
try {
|
try {
|
||||||
CompactionState compactionState = admin.getCompactionState(table.getName());
|
CompactionState compactionState = admin.getCompactionState(table.getName()).get();
|
||||||
%>
|
%>
|
||||||
<%= compactionState %>
|
<%= compactionState %>
|
||||||
<%
|
<%
|
||||||
|
@ -503,7 +506,7 @@ if (fqtn != null && master.isInitialized()) {
|
||||||
if (urlRegionServer != null) {
|
if (urlRegionServer != null) {
|
||||||
%>
|
%>
|
||||||
<td>
|
<td>
|
||||||
<a href="<%= urlRegionServer %>"><%= StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + ":" + master.getRegionServerInfoPort(addr) %></a>
|
<a href="<%= urlRegionServer %>"><%= addr == null? "-": StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + ":" + master.getRegionServerInfoPort(addr) %></a>
|
||||||
</td>
|
</td>
|
||||||
<%
|
<%
|
||||||
} else {
|
} else {
|
||||||
|
@ -577,7 +580,7 @@ if (withReplica) {
|
||||||
%><%= StringEscapeUtils.escapeHtml4(element.toString()) %><%
|
%><%= StringEscapeUtils.escapeHtml4(element.toString()) %><%
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
admin.close();
|
connection.close();
|
||||||
}
|
}
|
||||||
} // end else
|
} // end else
|
||||||
%>
|
%>
|
||||||
|
|
Loading…
Reference in New Issue