hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [5/5] git commit: HBASE-12322 Add Clean command to ITBLL
Date Thu, 30 Oct 2014 03:58:11 GMT
HBASE-12322 Add Clean command to ITBLL

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

Signed-off-by: stack <stack@apache.org>
Amending-Author: Andrew Purtell <apurtell@apache.org>


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

Branch: refs/heads/0.98
Commit: ea479051f177bef91c508305c800b351b9a9abf7
Parents: 941b4a7
Author: Elliott Clark <eclark@apache.org>
Authored: Wed Oct 29 20:56:58 2014 -0700
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Wed Oct 29 20:56:58 2014 -0700

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


http://git-wip-us.apache.org/repos/asf/hbase/blob/ea479051/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 5abcaf6..0fd546b 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.Get;
@@ -1035,6 +1037,37 @@ 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);
+      HBaseAdmin admin = new HBaseAdmin(conf);
+      try {
+        if (admin.tableExists(tableName)) {
+          admin.disableTable(tableName);
+          admin.deleteTable(tableName);
+        }
+      } finally {
+        admin.close();
+      }
+
+      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));
   }
@@ -1108,6 +1141,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();
   }
@@ -1143,6 +1177,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