[ 
https://issues.apache.org/jira/browse/HBASE-5198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sujee Maniyam updated HBASE-5198:
---------------------------------

    Release Note: --presplit option will not re-create TestTable if it already 
exists
          Status: Patch Available  (was: Open)

diff --git a/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java 
b/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java
index 16c7653..c6a8ffa 100644
--- a/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java
+++ b/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java
@@ -466,29 +466,26 @@ public class PerformanceEvaluation {
    */
   private boolean checkTable(HBaseAdmin admin) throws IOException {
     HTableDescriptor tableDescriptor = getTableDescriptor();
-    if (this.presplitRegions > 0) {
-      // presplit requested
-      if (admin.tableExists(tableDescriptor.getName())) {
-        admin.disableTable(tableDescriptor.getName());
-        admin.deleteTable(tableDescriptor.getName());
-      }
-
-      byte[][] splits = getSplits();
-      for (int i=0; i < splits.length; i++) {
-        LOG.debug(" split " + i + ": " + Bytes.toStringBinary(splits[i]));
-      }
-      admin.createTable(tableDescriptor, splits);
-      LOG.info ("Table created with " + this.presplitRegions + " splits");
-    }
-    else {
-      boolean tableExists = admin.tableExists(tableDescriptor.getName());
-      if (!tableExists) {
+    boolean tableExists = admin.tableExists(tableDescriptor.getName());
+    if (!tableExists) {
+      if (this.presplitRegions > 0) {
+        // presplit requested
+        byte[][] splits = getSplits();
+        for (int i = 0; i < splits.length; i++) {
+          LOG.debug(" split " + i + ": " + Bytes.toStringBinary(splits[i]));
+        }
+        admin.createTable(tableDescriptor, splits);
+        LOG.info("Table created with " + this.presplitRegions + " splits");
+      } else {
         admin.createTable(tableDescriptor);
         LOG.info("Table " + tableDescriptor + " created");
       }
+    } else if (this.presplitRegions > 0) {
+      // presplit option has no effect if table already exists
+      LOG.warn("Table '" + tableDescriptor.getNameAsString()
+          + "' already exists.  --presplit option did not take effect");
     }
-    boolean tableExists = admin.tableExists(tableDescriptor.getName());
-    return tableExists;
+    return admin.tableExists(tableDescriptor.getName());
   }
 
   protected HTableDescriptor getTableDescriptor() {
                
> PerformanceEvaluation --presplit option should not recreate TestTable if it 
> exists
> ----------------------------------------------------------------------------------
>
>                 Key: HBASE-5198
>                 URL: https://issues.apache.org/jira/browse/HBASE-5198
>             Project: HBase
>          Issue Type: Improvement
>          Components: util
>            Reporter: Sujee Maniyam
>            Assignee: Sujee Maniyam
>            Priority: Minor
>              Labels: benchmark
>
> --presplit option was added in 
> https://issues.apache.org/jira/browse/HBASE-4440 
> It  drops and re-creates TestTable if the table exists.
> This behavior in-consistent with previous ones.  If TestTable exists, it 
> shouldn't be re-created

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to