hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r667295 - in /hadoop/hbase/trunk: ./ src/java/org/apache/hadoop/hbase/ src/java/org/apache/hadoop/hbase/master/ src/test/org/apache/hadoop/hbase/
Date Thu, 12 Jun 2008 23:53:56 GMT
Author: stack
Date: Thu Jun 12 16:53:56 2008
New Revision: 667295

URL: http://svn.apache.org/viewvc?rev=667295&view=rev
Log:
HBASE-682 Regularize toString

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HColumnDescriptor.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HTableDescriptor.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/BaseScanner.java
    hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestToString.java

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=667295&r1=667294&r2=667295&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Thu Jun 12 16:53:56 2008
@@ -83,6 +83,7 @@
    HBASE-672   Sort regions in the regionserver UI
    HBASE-677   Make HTable, HRegion, HRegionServer, HStore, and HColumnDescriptor
                subclassable (Clint Morgan via Stack)
+   HBASE-682   Regularize toString
 
   NEW FEATURES
    HBASE-47    Option to set TTL for columns in hbase

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HColumnDescriptor.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HColumnDescriptor.java?rev=667295&r1=667294&r2=667295&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HColumnDescriptor.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HColumnDescriptor.java Thu Jun 12
16:53:56 2008
@@ -93,6 +93,17 @@
   public static final BloomFilterDescriptor DEFAULT_BLOOM_FILTER_DESCRIPTOR =
     null;
 
+  // Defines for jruby/shell
+  public static final String NAME = "NAME";
+  public static final String MAX_VERSIONS = "MAX_VERSIONS";
+  public static final String COMPRESSION = "COMPRESSION";
+  public static final String IN_MEMORY = "IN_MEMORY";
+  public static final String BLOCKCACHE = "BLOCKCACHE";
+  public static final String MAX_LENGTH = "MAX_LENGTH";
+  public static final String TTL = "TTL";
+  public static final String BLOOMFILTER = "BLOOMFILTER";
+  public static final String FOREVER = "FOREVER";
+
   // Column family name
   private byte [] name;
   // Number of versions to keep
@@ -289,16 +300,17 @@
   /** {@inheritDoc} */
   @Override
   public String toString() {
-    return "{name: " + Bytes.toString(name) +
-      ", max versions: " + maxVersions +
-      ", compression: " + this.compressionType + ", in memory: " + inMemory +
-      ", block cache enabled: " + blockCacheEnabled +
-      ", max length: " + maxValueLength +
-      ", time to live: " +
+    return "{" + NAME + " => '" + Bytes.toString(name) +
+      "', " + MAX_VERSIONS + " => " + maxVersions +
+      ", " + COMPRESSION + " => " + this.compressionType +
+      ", " + IN_MEMORY + " => " + inMemory +
+      ", " + BLOCKCACHE + " => " + blockCacheEnabled +
+      ", " + MAX_LENGTH + " => " + maxValueLength +
+      ", " + TTL + " => " +
           (timeToLive == HConstants.FOREVER ? "FOREVER" : 
               Integer.toString(timeToLive)) +
-      ", bloom filter: " +
-          (bloomFilterSpecified ? bloomFilter.toString() : "none") +
+      ", " + BLOOMFILTER + " => " +
+        (bloomFilterSpecified ? bloomFilter.toString() : CompressionType.NONE) +
       "}";
   }
   

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HTableDescriptor.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HTableDescriptor.java?rev=667295&r1=667294&r2=667295&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HTableDescriptor.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HTableDescriptor.java Thu Jun 12 16:53:56
2008
@@ -59,6 +59,8 @@
   private byte [] name = HConstants.EMPTY_BYTE_ARRAY;
   private String nameAsString = "";
   
+  public static final String FAMILIES = "FAMILIES";
+  
   // Key is hash of the family name.
   private final Map<Integer, HColumnDescriptor> families =
     new HashMap<Integer, HColumnDescriptor>();
@@ -189,8 +191,8 @@
    */
   @Override
   public String toString() {
-    return "name: " + Bytes.toString(this.name) + ", families: " +
-      this.families.values();
+    return HColumnDescriptor.NAME + " => '" + Bytes.toString(this.name) +
+      "', " + FAMILIES + " => " + this.families.values();
   }
   
   /** {@inheritDoc} */

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/BaseScanner.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/BaseScanner.java?rev=667295&r1=667294&r2=667295&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/BaseScanner.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/BaseScanner.java Thu Jun 12
16:53:56 2008
@@ -172,9 +172,9 @@
         String serverName = Writables.cellToString(values.get(COL_SERVER));
         long startCode = Writables.cellToLong(values.get(COL_STARTCODE));
         if (LOG.isDebugEnabled()) {
-          LOG.debug(Thread.currentThread().getName() + " regioninfo: {" +
-            info.toString() + "}, server: " + serverName + ", startCode: " +
-            startCode);
+          LOG.debug(Thread.currentThread().getName() + " {" +
+            info.toString() + "}, SERVER => '" + serverName +
+            "', STARTCODE => " + startCode);
         }
 
         // Note Region has been assigned.

Modified: hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestToString.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestToString.java?rev=667295&r1=667294&r2=667295&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestToString.java (original)
+++ hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestToString.java Thu Jun 12 16:53:56
2008
@@ -36,30 +36,4 @@
     assertEquals("HServerInfo", "address: " + hostport + ", startcode: -1" +
         ", load: (requests: 0 regions: 0)", info.toString());
   }
-
-  /**
-   * Test HTableDescriptor.toString();
-   */
-  public void testHTableDescriptor() {
-    HTableDescriptor htd = HTableDescriptor.ROOT_TABLEDESC;
-    System. out.println(htd.toString());
-    assertEquals("Table descriptor", "name: -ROOT-, families: [{name: " +
-      "info, max versions: 1, compression: NONE, in memory: false, " +
-      "block cache enabled: false, max length: 2147483647, " +
-      "time to live: FOREVER, bloom filter: none}]", htd.toString());
-  }
-  
-  /**
-   * Tests HRegionInfo.toString()
-   */
-  public void testHRegionInfo() {
-    HRegionInfo hri = HRegionInfo.ROOT_REGIONINFO;
-    System.out.println(hri.toString());
-    assertEquals("HRegionInfo", 
-      "regionname: -ROOT-,,0, startKey: <>, endKey: <>, encodedName: 70236052,
tableDesc: " +
-      "{name: -ROOT-, families: [{name: info, max versions: 1, " +
-      "compression: NONE, in memory: false, block cache enabled: false, " +
-      "max length: 2147483647, time to live: FOREVER, bloom filter: none}]}",
-      hri.toString());
-  }
 }



Mime
View raw message