hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1159515 - in /hbase/trunk: ./ src/main/jamon/org/apache/hbase/tmpl/master/ src/main/java/org/apache/hadoop/hbase/ src/main/resources/hbase-webapps/master/
Date Fri, 19 Aug 2011 06:26:14 GMT
Author: stack
Date: Fri Aug 19 06:26:14 2011
New Revision: 1159515

URL: http://svn.apache.org/viewvc?rev=1159515&view=rev
Log:
HBASE-4227 Modify the webUI so that default values of column families are not shown

Added:
    hbase/trunk/src/main/resources/hbase-webapps/master/tablesDetailed.jsp
Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/jamon/org/apache/hbase/tmpl/master/MasterStatusTmpl.jamon
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1159515&r1=1159514&r2=1159515&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Fri Aug 19 06:26:14 2011
@@ -381,6 +381,8 @@ Release 0.91.0 - Unreleased
                call contents
    HBASE-4190  Coprocessors: pull up some cp constants from cp package to
                o.a.h.h.HConstants (Mingjie Lai)
+   HBASE-4227  Modify the webUI so that default values of column families are
+               not shown (Nileema Shingte)
 
   TASKS
    HBASE-3559  Move report of split to master OFF the heartbeat channel

Modified: hbase/trunk/src/main/jamon/org/apache/hbase/tmpl/master/MasterStatusTmpl.jamon
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/jamon/org/apache/hbase/tmpl/master/MasterStatusTmpl.jamon?rev=1159515&r1=1159514&r2=1159515&view=diff
==============================================================================
--- hbase/trunk/src/main/jamon/org/apache/hbase/tmpl/master/MasterStatusTmpl.jamon (original)
+++ hbase/trunk/src/main/jamon/org/apache/hbase/tmpl/master/MasterStatusTmpl.jamon Fri Aug
19 06:26:14 2011
@@ -158,11 +158,11 @@ org.apache.hadoop.hbase.HTableDescriptor
     <%if (frags != null) %>
         <td align="center"><% frags.get(htDesc.getNameAsString()) != null ? frags.get(htDesc.getNameAsString()).intValue()
+ "%" : "n/a" %></td>
     </%if>
-    <td><% htDesc.toString() %></td>
+    <td><% htDesc.toStringCustomizedValues() %></td>
 </tr>
 </%for>
 
-<p> <% tables.length %> table(s) in set.</p>
+<p> <% tables.length %> table(s) in set. [<a href=tablesDetailed.jsp>Details</a>]</p>
 </table>
 </%if>
 </%def>

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java?rev=1159515&r1=1159514&r2=1159515&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java Fri Aug 19 06:26:14
2011
@@ -135,6 +135,18 @@ public class HColumnDescriptor implement
    */
   public static final int DEFAULT_REPLICATION_SCOPE = HConstants.REPLICATION_SCOPE_LOCAL;
 
+  private final static Map<String, String> DEFAULT_VALUES = new HashMap<String,
String>();
+  static {
+      DEFAULT_VALUES.put(BLOOMFILTER, DEFAULT_BLOOMFILTER);
+      DEFAULT_VALUES.put(REPLICATION_SCOPE, String.valueOf(DEFAULT_REPLICATION_SCOPE));
+      DEFAULT_VALUES.put(HConstants.VERSIONS, String.valueOf(DEFAULT_VERSIONS));
+      DEFAULT_VALUES.put(COMPRESSION, DEFAULT_COMPRESSION);
+      DEFAULT_VALUES.put(TTL, String.valueOf(DEFAULT_TTL));
+      DEFAULT_VALUES.put(BLOCKSIZE, String.valueOf(DEFAULT_BLOCKSIZE));
+      DEFAULT_VALUES.put(HConstants.IN_MEMORY, String.valueOf(DEFAULT_IN_MEMORY));
+      DEFAULT_VALUES.put(BLOCKCACHE, String.valueOf(DEFAULT_BLOCKCACHE));
+  }
+
   // Column family name
   private byte [] name;
 
@@ -575,6 +587,32 @@ public class HColumnDescriptor implement
   }
 
   /**
+   * @return Column family descriptor with only the customized attributes.
+   */
+  public String toStringCustomizedValues() {
+    StringBuilder s = new StringBuilder();
+    s.append('{');
+    s.append(HConstants.NAME);
+    s.append(" => '");
+    s.append(Bytes.toString(name));
+    s.append("'");
+    for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> e:
+        values.entrySet()) {
+      String key = Bytes.toString(e.getKey().get());
+      String value = Bytes.toString(e.getValue().get());
+      if(DEFAULT_VALUES.get(key) == null || !DEFAULT_VALUES.get(key).equalsIgnoreCase(value))
{
+        s.append(", ");
+        s.append(key);
+        s.append(" => '");
+        s.append(value);
+        s.append("'");
+      }
+    }
+    s.append('}');
+    return s.toString();
+  }
+
+  /**
    * @see java.lang.Object#equals(java.lang.Object)
    */
   @Override

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java?rev=1159515&r1=1159514&r2=1159515&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java Fri Aug 19 06:26:14
2011
@@ -518,6 +518,52 @@ public class HTableDescriptor implements
   }
 
   /**
+   * @return Name of this table and then a map of all of the column family
+   * descriptors (with only the non-default column family attributes)
+   */
+  public String toStringCustomizedValues() {
+    StringBuilder s = new StringBuilder();
+    s.append('{');
+    s.append(HConstants.NAME);
+    s.append(" => '");
+    s.append(Bytes.toString(name));
+    s.append("'");
+    for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> e:
+        values.entrySet()) {
+      String key = Bytes.toString(e.getKey().get());
+      String value = Bytes.toString(e.getValue().get());
+      if (key == null) {
+        continue;
+      }
+      String upperCase = key.toUpperCase();
+      if (upperCase.equals(IS_ROOT) || upperCase.equals(IS_META)) {
+        // Skip. Don't bother printing out read-only values if false.
+        if (value.toLowerCase().equals(Boolean.FALSE.toString())) {
+          continue;
+        }
+      }
+      s.append(", ");
+      s.append(Bytes.toString(e.getKey().get()));
+      s.append(" => '");
+      s.append(Bytes.toString(e.getValue().get()));
+      s.append("'");
+    }
+    s.append(", ");
+    s.append(FAMILIES);
+    s.append(" => [");
+    int size = families.values().size();
+    int i = 0;
+    for(HColumnDescriptor hcd : families.values()) {
+      s.append(hcd.toStringCustomizedValues());
+      i++;
+      if( i != size)
+        s.append(", ");
+    }
+    s.append("]}");
+    return s.toString();
+  }
+
+  /**
    * @see java.lang.Object#equals(java.lang.Object)
    */
   @Override

Added: hbase/trunk/src/main/resources/hbase-webapps/master/tablesDetailed.jsp
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/resources/hbase-webapps/master/tablesDetailed.jsp?rev=1159515&view=auto
==============================================================================
--- hbase/trunk/src/main/resources/hbase-webapps/master/tablesDetailed.jsp (added)
+++ hbase/trunk/src/main/resources/hbase-webapps/master/tablesDetailed.jsp Fri Aug 19 06:26:14
2011
@@ -0,0 +1,40 @@
+<%@ page contentType="text/html;charset=UTF-8"
+  import="java.util.*"
+  import="org.apache.hadoop.util.StringUtils"
+  import="org.apache.hadoop.conf.Configuration"
+  import="org.apache.hadoop.hbase.master.HMaster"
+  import="org.apache.hadoop.hbase.client.HBaseAdmin"
+  import="org.apache.hadoop.hbase.HTableDescriptor" %><%
+  HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER);
+  Configuration conf = master.getConfiguration();
+%>
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+<title>HBase Master: <%= master.getServerName()%>%></title>
+<link rel="stylesheet" type="text/css" href="/static/hbase.css" />
+</head>
+<body>
+
+<h2>User Tables</h2>
+<% HTableDescriptor[] tables = new HBaseAdmin(conf).listTables();
+   if(tables != null && tables.length > 0) { %>
+<table>
+<tr>
+    <th>Table</th>
+    <th>Description</th>
+</tr>
+<%   for(HTableDescriptor htDesc : tables ) { %>
+<tr>
+    <td><%= htDesc.getNameAsString() %></td>
+    <td><%= htDesc.toString() %></td>
+</tr>
+<%   }  %>
+
+<p> <%= tables.length %> table(s) in set.</p>
+</table>
+<% } %>
+</body>
+</html>



Mime
View raw message