hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r707792 - in /hadoop/hbase/trunk: CHANGES.txt src/test/org/apache/hadoop/hbase/PerformanceEvaluation.java
Date Fri, 24 Oct 2008 23:48:59 GMT
Author: stack
Date: Fri Oct 24 16:48:59 2008
New Revision: 707792

URL: http://svn.apache.org/viewvc?rev=707792&view=rev
Log:
HBASE-957 PerformanceEvaluation tests if table exists by comparing descriptors

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/PerformanceEvaluation.java

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=707792&r1=707791&r2=707792&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Fri Oct 24 16:48:59 2008
@@ -43,6 +43,7 @@
    HBASE-952   Deadlock in HRegion.batchUpdate
    HBASE-954   Don't reassign root region until ProcessServerShutdown has split
                the former region server's log
+   HBASE-953   PerformanceEvaluation tests if table exists by comparing descriptors
 
   IMPROVEMENTS
    HBASE-901   Add a limit to key length, check key and value length on client side

Modified: hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/PerformanceEvaluation.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/PerformanceEvaluation.java?rev=707792&r1=707791&r2=707792&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/PerformanceEvaluation.java (original)
+++ hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/PerformanceEvaluation.java Fri Oct
24 16:48:59 2008
@@ -81,10 +81,10 @@
   
   static final byte [] COLUMN_NAME = Bytes.toBytes(COLUMN_FAMILY_STR + "data");
   
-  protected static HTableDescriptor tableDescriptor;
+  protected static HTableDescriptor TABLE_DESCRIPTOR;
   static {
-    tableDescriptor = new HTableDescriptor("TestTable");
-    tableDescriptor.addFamily(new HColumnDescriptor(COLUMN_FAMILY));
+    TABLE_DESCRIPTOR = new HTableDescriptor("TestTable");
+    TABLE_DESCRIPTOR.addFamily(new HColumnDescriptor(COLUMN_FAMILY));
   }
   
   private static final String RANDOM_READ = "randomRead";
@@ -198,21 +198,10 @@
    * @throws IOException
    */
   private boolean checkTable(HBaseAdmin admin) throws IOException {
-    HTableDescriptor [] extantTables = admin.listTables();
-    boolean tableExists = false;
-    if (extantTables.length > 0) {
-      // Check to see if our table already exists.  Print warning if it does.
-      for (int i = 0; i < extantTables.length; i++) {
-        if (extantTables[i].equals(tableDescriptor)) {
-          LOG.warn("Table " + tableDescriptor + " already exists");
-          tableExists = true;
-          break;
-        }
-      }
-    }
+    boolean tableExists = admin.tableExists(TABLE_DESCRIPTOR.getName());
     if (!tableExists) {
-      admin.createTable(tableDescriptor);
-      LOG.info("Table " + tableDescriptor + " created");
+      admin.createTable(TABLE_DESCRIPTOR);
+      LOG.info("Table " + TABLE_DESCRIPTOR + " created");
     }
     return !tableExists;
   }
@@ -371,7 +360,7 @@
     
     void testSetup() throws IOException {
       this.admin = new HBaseAdmin(conf);
-      this.table = new HTable(conf, tableDescriptor.getName());
+      this.table = new HTable(conf, TABLE_DESCRIPTOR.getName());
       this.table.setAutoFlush(false);
       this.table.setWriteBufferSize(1024*1024*12);
     }



Mime
View raw message