hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [1/6] hbase git commit: HBASE-12404 Task 5 from parent: Replace internal HTable constructor use with HConnection#getTable (0.98, 0.99)
Date Tue, 25 Nov 2014 20:27:27 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 39c67f603 -> c0cdaf840


http://git-wip-us.apache.org/repos/asf/hbase/blob/c0cdaf84/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/TestOfflineMetaRebuildBase.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/TestOfflineMetaRebuildBase.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/TestOfflineMetaRebuildBase.java
index 7a075a6..37f3abd 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/TestOfflineMetaRebuildBase.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/TestOfflineMetaRebuildBase.java
@@ -26,6 +26,9 @@ import java.util.Arrays;
 
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.MediumTests;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
 import org.apache.hadoop.hbase.client.HConnectionManager;
 import org.apache.hadoop.hbase.util.HBaseFsck;
 import org.apache.hadoop.hbase.util.HBaseFsck.ErrorReporter.ERROR_CODE;
@@ -58,7 +61,6 @@ public class TestOfflineMetaRebuildBase extends OfflineMetaRebuildTestCore
{
     // shutdown the minicluster
     TEST_UTIL.shutdownMiniHBaseCluster();
     TEST_UTIL.shutdownMiniZKCluster();
-    HConnectionManager.deleteConnection(conf);
 
     // rebuild meta table from scratch
     HBaseFsck fsck = new HBaseFsck(conf);
@@ -67,25 +69,22 @@ public class TestOfflineMetaRebuildBase extends OfflineMetaRebuildTestCore
{
     // bring up the minicluster
     TEST_UTIL.startMiniZKCluster();
     TEST_UTIL.restartHBaseCluster(3);
-    TEST_UTIL.getHBaseAdmin().enableTable(table);
-    ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(TEST_UTIL);
-    
-    LOG.info("Waiting for no more RIT");
-    ZKAssign.blockUntilNoRIT(zkw);
-    LOG.info("No more RIT in ZK, now doing final test verification");
+    try (Connection connection = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration()))
{
+      Admin admin = connection.getAdmin();
+      admin.enableTable(table);
+      LOG.info("Waiting for no more RIT");
+      TEST_UTIL.waitUntilNoRegionsInTransition(60000);
+      LOG.info("No more RIT in ZK, now doing final test verification");
 
-    // everything is good again.
-    assertEquals(5, scanMeta());
-    HTableDescriptor[] htbls = TEST_UTIL.getHBaseAdmin().listTables();
-    LOG.info("Tables present after restart: " + Arrays.toString(htbls));
+      // everything is good again.
+      assertEquals(5, scanMeta());
+      HTableDescriptor[] htbls = admin.listTables();
+      LOG.info("Tables present after restart: " + Arrays.toString(htbls));
+      assertEquals(1, htbls.length);
+    }
 
-    assertEquals(1, htbls.length);
     assertErrors(doFsck(conf, false), new ERROR_CODE[] {});
-    LOG.info("Table " + table + " has " + tableRowCount(conf, table)
-        + " entries.");
+    LOG.info("Table " + table + " has " + tableRowCount(conf, table) + " entries.");
     assertEquals(16, tableRowCount(conf, table));
   }
-
-
 }
-

http://git-wip-us.apache.org/repos/asf/hbase/blob/c0cdaf84/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/TestOfflineMetaRebuildHole.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/TestOfflineMetaRebuildHole.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/TestOfflineMetaRebuildHole.java
index a3225bd..910373e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/TestOfflineMetaRebuildHole.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/TestOfflineMetaRebuildHole.java
@@ -27,6 +27,9 @@ import java.util.Arrays;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.MediumTests;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
 import org.apache.hadoop.hbase.util.HBaseFsck;
 import org.apache.hadoop.hbase.util.HBaseFsck.ErrorReporter.ERROR_CODE;
 import org.apache.hadoop.hbase.zookeeper.ZKAssign;
@@ -87,7 +90,7 @@ public class TestOfflineMetaRebuildHole extends OfflineMetaRebuildTestCore
{
 
     // Meta still messed up.
     assertEquals(1, scanMeta());
-    HTableDescriptor[] htbls = TEST_UTIL.getHBaseAdmin().listTables();
+    HTableDescriptor[] htbls = getTables(TEST_UTIL.getConfiguration());
     LOG.info("Tables present after restart: " + Arrays.toString(htbls));
 
     // After HBASE-451 HBaseAdmin.listTables() gets table descriptors from FS,
@@ -98,6 +101,4 @@ public class TestOfflineMetaRebuildHole extends OfflineMetaRebuildTestCore
{
         ERROR_CODE.NOT_IN_META_OR_DEPLOYED,
         ERROR_CODE.NOT_IN_META_OR_DEPLOYED});
   }
-
 }
-

http://git-wip-us.apache.org/repos/asf/hbase/blob/c0cdaf84/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/TestOfflineMetaRebuildOverlap.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/TestOfflineMetaRebuildOverlap.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/TestOfflineMetaRebuildOverlap.java
index 9a17948..8bc37e8 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/TestOfflineMetaRebuildOverlap.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/TestOfflineMetaRebuildOverlap.java
@@ -96,7 +96,7 @@ public class TestOfflineMetaRebuildOverlap extends OfflineMetaRebuildTestCore
{
 
     // Meta still messed up.
     assertEquals(1, scanMeta());
-    HTableDescriptor[] htbls = TEST_UTIL.getHBaseAdmin().listTables();
+    HTableDescriptor[] htbls = getTables(TEST_UTIL.getConfiguration());
     LOG.info("Tables present after restart: " + Arrays.toString(htbls));
 
     // After HBASE-451 HBaseAdmin.listTables() gets table descriptors from FS,
@@ -109,6 +109,4 @@ public class TestOfflineMetaRebuildOverlap extends OfflineMetaRebuildTestCore
{
             ERROR_CODE.NOT_IN_META_OR_DEPLOYED,
             ERROR_CODE.NOT_IN_META_OR_DEPLOYED});
   }
-
 }
-


Mime
View raw message