hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject git commit: HBASE-12322 Add Clean command to ITBLL
Date Fri, 24 Oct 2014 03:55:18 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 46e4bffc2 -> 64c67ffad


HBASE-12322 Add Clean command to ITBLL

Signed-off-by: stack <stack@apache.org>

Conflicts:
	hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestBigLinkedList.java


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/64c67ffa
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/64c67ffa
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/64c67ffa

Branch: refs/heads/branch-1
Commit: 64c67ffad2ccea5dca61046067ec6d7a5cfaf15f
Parents: 46e4bff
Author: Elliott Clark <eclark@apache.org>
Authored: Wed Oct 22 16:23:53 2014 -0700
Committer: stack <stack@apache.org>
Committed: Thu Oct 23 20:55:09 2014 -0700

----------------------------------------------------------------------
 .../test/IntegrationTestBigLinkedList.java      | 33 ++++++++++++++++++++
 1 file changed, 33 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/64c67ffa/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestBigLinkedList.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestBigLinkedList.java
b/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestBigLinkedList.java
index cdb682d..7493e4b 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestBigLinkedList.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestBigLinkedList.java
@@ -39,6 +39,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.conf.Configured;
+import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
@@ -48,6 +49,7 @@ import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.IntegrationTestBase;
 import org.apache.hadoop.hbase.IntegrationTestingUtility;
 import org.apache.hadoop.hbase.IntegrationTests;
+import org.apache.hadoop.hbase.fs.HFileSystem;
 import org.apache.hadoop.hbase.MasterNotRunningException;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Admin;
@@ -1037,6 +1039,34 @@ public class IntegrationTestBigLinkedList extends IntegrationTestBase
{
     }
   }
 
+  private static class Clean extends Configured implements Tool {
+
+    @Override public int run(String[] args) throws Exception {
+      if (args.length < 1) {
+        System.err.println("Usage: Clean <output dir>");
+        return -1;
+      }
+
+      Path p = new Path(args[0]);
+      Configuration conf = getConf();
+      TableName tableName = getTableName(conf);
+
+      FileSystem fs = HFileSystem.get(conf);
+      Admin admin = new HBaseAdmin(conf);
+
+      if (admin.tableExists(tableName)) {
+        admin.disableTable(tableName);
+        admin.deleteTable(tableName);
+      }
+
+      if (fs.exists(p)) {
+        fs.delete(p, true);
+      }
+
+      return 0;
+    }
+  }
+
   static TableName getTableName(Configuration conf) {
     return TableName.valueOf(conf.get(TABLE_NAME_KEY, DEFAULT_TABLE_NAME));
   }
@@ -1110,6 +1140,7 @@ public class IntegrationTestBigLinkedList extends IntegrationTestBase
{
     System.err.println("                             single node.");
     System.err.println("  Loop                       A program to Loop through Generator
and");
     System.err.println("                             Verify steps");
+    System.err.println("  Clean                      A program to clean all left over detritus.");
     System.err.println("\t  ");
     System.err.flush();
   }
@@ -1145,6 +1176,8 @@ public class IntegrationTestBigLinkedList extends IntegrationTestBase
{
       tool = new Print();
     } else if (toRun.equals("Delete")) {
       tool = new Delete();
+    } else if (toRun.equals("Clean")) {
+      tool = new Clean();
     } else {
       usage();
       throw new RuntimeException("Unknown arg");


Mime
View raw message