HBASE-15209 (compatibility) Disable table in HBaseTestingUtility.truncateTable. 
(Apekshit)

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


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

Branch: refs/heads/hbase-12439
Commit: 31f9f2fb67e4c83748d725947ed5eb2cd13df1ef
Parents: 81d81c9
Author: Apekshit <apeksha...@gmail.com>
Authored: Tue Feb 2 18:24:17 2016 -0800
Committer: stack <st...@apache.org>
Committed: Fri Feb 5 20:41:40 2016 -0800

----------------------------------------------------------------------
 .../test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java    | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/31f9f2fb/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
index 71a3344..4360e1e 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
@@ -1874,6 +1874,9 @@ public class HBaseTestingUtility extends 
HBaseCommonTestingUtility {
    */
   public HTable truncateTable(final TableName tableName, final boolean 
preserveRegions) throws IOException {
     Admin admin = getHBaseAdmin();
+    if (!admin.isTableDisabled(tableName)) {
+      admin.disableTable(tableName);
+    }
     admin.truncateTable(tableName, preserveRegions);
     return (HTable) getConnection().getTable(tableName);
   }

Reply via email to