HBASE-13718 added columns schema to table description in web view

Summary:
 * added a new table "Table Schema" on the table description page
 * per column, list all the key/values on the column description

Test Plan:
 * mvn test # and wait..
 * create a new table using hbase shell:
   * create 'mytesttable', {NAME=>'CF1'}, {NAME=>'CF2'}
 * open http://localhost:16010/table.jsp?name=mytesttable
 * check the "Table Schema" appears and lists the columns correctly

Reviewers: eclark, vicka.dudin

Differential Revision: https://reviews.facebook.net/D38649

Signed-off-by: Elliott Clark <eclark@apache.org>
This commit is contained in:
Joao Girao 2015-05-28 17:07:25 -07:00 committed by Sean Busbey
parent f5ae21ea32
commit e7efa23d07
1 changed files with 40 additions and 0 deletions

View File

@ -27,6 +27,7 @@
import="java.util.Map"
import="java.util.Collections"
import="java.util.Comparator"
import="java.util.Collection"
import="org.apache.hadoop.conf.Configuration"
import="org.apache.hadoop.util.StringUtils"
import="org.apache.hadoop.hbase.client.HTable"
@ -37,6 +38,7 @@
import="org.apache.hadoop.hbase.ServerLoad"
import="org.apache.hadoop.hbase.RegionLoad"
import="org.apache.hadoop.hbase.HConstants"
import="org.apache.hadoop.hbase.io.ImmutableBytesWritable"
import="org.apache.hadoop.hbase.master.HMaster"
import="org.apache.hadoop.hbase.zookeeper.MetaTableLocator"
import="org.apache.hadoop.hbase.util.Bytes"
@ -46,6 +48,7 @@
import="org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos"
import="org.apache.hadoop.hbase.protobuf.generated.HBaseProtos"
import="org.apache.hadoop.hbase.TableName"
import="org.apache.hadoop.hbase.HColumnDescriptor"
import="org.apache.hadoop.hbase.client.RegionReplicaUtil"
import="org.apache.hadoop.hbase.HBaseConfiguration" %>
<%
@ -300,6 +303,43 @@ if ( fqtn != null ) {
</tr>
<% } %>
</table>
<h2>Table Schema</h2>
<table class="table table-striped">
<tr>
<th>Column Name</th>
<th></th>
</tr>
<%
Collection<HColumnDescriptor> families = table.getTableDescriptor().getFamilies();
for (HColumnDescriptor family: families) {
%>
<tr>
<td><%= family.getNameAsString() %></td>
<td>
<table class="table table-striped">
<tr>
<th>Property</th>
<th>Value</th>
</tr>
<%
Map<ImmutableBytesWritable, ImmutableBytesWritable> familyValues = family.getValues();
for (ImmutableBytesWritable familyKey: familyValues.keySet()) {
final ImmutableBytesWritable familyValue = familyValues.get(familyKey);
%>
<tr>
<td>
<%= Bytes.toString(familyKey.get(), familyKey.getOffset(), familyKey.getLength()) %>
</td>
<td>
<%= Bytes.toString(familyValue.get(), familyValue.getOffset(), familyValue.getLength()) %>
</td>
</tr>
<% } %>
</table>
</td>
</tr>
<% } %>
</table>
<%
long totalReadReq = 0;
long totalWriteReq = 0;