hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [1/5] hbase git commit: HBASE-13017 Backport HBASE-12035 Keep table state in Meta to 1.0 branch (Andrey Stepachev)
Date Wed, 18 Feb 2015 17:58:46 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 8afb80bc0 -> f5e2a8232


http://git-wip-us.apache.org/repos/asf/hbase/blob/f5e2a823/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRegionStates.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRegionStates.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRegionStates.java
index 20cbd62..a35e359 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRegionStates.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRegionStates.java
@@ -19,10 +19,8 @@ package org.apache.hadoop.hbase.master;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.hadoop.hbase.Server;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.TableStateManager;
 import org.apache.hadoop.hbase.testclassification.SmallTests;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -43,7 +41,7 @@ public class TestRegionStates {
 
   @Test
   public void testWeDontReturnDrainingServersForOurBalancePlans() throws Exception {
-    Server server = mock(Server.class);
+    MasterServices server = mock(MasterServices.class);
     when(server.getServerName()).thenReturn(ServerName.valueOf("master,1,1"));
     Configuration configuration = mock(Configuration.class);
     when(server.getConfiguration()).thenReturn(configuration);

http://git-wip-us.apache.org/repos/asf/hbase/blob/f5e2a823/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestEnableTableHandler.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestEnableTableHandler.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestEnableTableHandler.java
index 39b347d..93b8755 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestEnableTableHandler.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestEnableTableHandler.java
@@ -18,25 +18,32 @@
  */
 package org.apache.hadoop.hbase.master.handler;
 
-import java.util.Collections;
+import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
 
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.MetaTableAccessor;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.MetaTableAccessor;
 import org.apache.hadoop.hbase.MiniHBaseCluster;
 import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.ResultScanner;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.client.Table;
 import org.apache.hadoop.hbase.master.HMaster;
 import org.apache.hadoop.hbase.testclassification.MediumTests;
 import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.hbase.util.FSTableDescriptors;
 import org.apache.hadoop.hbase.util.JVMClusterUtil;
 import org.junit.After;
 import org.junit.Before;
@@ -46,13 +53,6 @@ import org.junit.experimental.categories.Category;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import java.io.IOException;
-import org.apache.hadoop.hbase.client.Delete;
-import org.apache.hadoop.hbase.client.Result;
-import org.apache.hadoop.hbase.client.ResultScanner;
-import org.apache.hadoop.hbase.client.Scan;
-import org.apache.hadoop.hbase.client.Table;
-
 @Category({ MediumTests.class })
 public class TestEnableTableHandler {
   private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
@@ -84,7 +84,6 @@ public class TestEnableTableHandler {
 
     admin.enableTable(tableName);
     TEST_UTIL.waitTableEnabled(tableName);
-
     // disable once more
     admin.disableTable(tableName);
 
@@ -94,30 +93,49 @@ public class TestEnableTableHandler {
     rs.getRegionServer().stop("stop");
     cluster.waitForRegionServerToStop(rs.getRegionServer().getServerName(), 10000);
 
-    TEST_UTIL.waitUntilAllRegionsAssigned(TableName.META_TABLE_NAME);
+    LOG.debug("Now enabling table " + tableName);
 
     admin.enableTable(tableName);
     assertTrue(admin.isTableEnabled(tableName));
 
     JVMClusterUtil.RegionServerThread rs2 = cluster.startRegionServer();
-    m.getAssignmentManager().assign(admin.getTableRegions(tableName));
+    cluster.waitForRegionServerToStart(rs2.getRegionServer().getServerName().getHostname(),
+        rs2.getRegionServer().getServerName().getPort(), 60000);
+
+    List<HRegionInfo> regions = TEST_UTIL.getHBaseAdmin().getTableRegions(tableName);
+    assertEquals(1, regions.size());
+    for (HRegionInfo region : regions) {
+      TEST_UTIL.getHBaseAdmin().assign(region.getEncodedNameAsBytes());
+    }
+    LOG.debug("Waiting for table assigned " + tableName);
     TEST_UTIL.waitUntilAllRegionsAssigned(tableName);
     List<HRegionInfo> onlineRegions = admin.getOnlineRegions(
         rs2.getRegionServer().getServerName());
-    assertEquals(2, onlineRegions.size());
-    assertEquals(tableName, onlineRegions.get(1).getTable());
+    ArrayList<HRegionInfo> tableRegions = filterTableRegions(tableName, onlineRegions);
+    assertEquals(1, tableRegions.size());
+  }
+
+  private ArrayList<HRegionInfo> filterTableRegions(final TableName tableName,
+      List<HRegionInfo> onlineRegions) {
+    return Lists.newArrayList(Iterables.filter(onlineRegions, new Predicate<HRegionInfo>()
{
+      @Override
+      public boolean apply(HRegionInfo input) {
+        return input.getTable().equals(tableName);
+      }
+    }));
   }
 
   /**
    * We were only clearing rows that had a hregioninfo column in hbase:meta.  Mangled rows
that
    * were missing the hregioninfo because of error were being left behind messing up any
    * subsequent table made with the same name. HBASE-12980
+   *
    * @throws IOException
    * @throws InterruptedException
    */
-  @Test(timeout=60000)
+  @Test(timeout = 60000)
   public void testDeleteForSureClearsAllTableRowsFromMeta()
-  throws IOException, InterruptedException {
+      throws IOException, InterruptedException {
     final TableName tableName = TableName.valueOf("testDeleteForSureClearsAllTableRowsFromMeta");
     final MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
     final HMaster m = cluster.getMaster();

http://git-wip-us.apache.org/repos/asf/hbase/blob/f5e2a823/hbase-server/src/test/java/org/apache/hadoop/hbase/migration/TestUpgradeTo96.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/migration/TestUpgradeTo96.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/migration/TestUpgradeTo96.java
index 2a8c9e3..dc4bc40 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/migration/TestUpgradeTo96.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/migration/TestUpgradeTo96.java
@@ -30,6 +30,7 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.FsShell;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.client.TableState;
 import org.apache.hadoop.hbase.testclassification.MediumTests;
 import org.apache.hadoop.hbase.io.FileLink;
 import org.apache.hadoop.hbase.io.HFileLink;
@@ -136,7 +137,7 @@ public class TestUpgradeTo96 {
     // add table znode, data of its children would be protobuffized
     tableAZnode = ZKUtil.joinZNode(zkw.tableZNode, "a");
     ZKUtil.createWithParents(zkw, tableAZnode,
-      Bytes.toBytes(ZooKeeperProtos.Table.State.ENABLED.toString()));
+      Bytes.toBytes(TableState.State.ENABLED.toString()));
     // add replication znodes, data of its children would be protobuffized
     String replicationZnode = ZKUtil.joinZNode(zkw.baseZNode, "replication");
     replicationPeerZnode = ZKUtil.joinZNode(replicationZnode, "peers");

http://git-wip-us.apache.org/repos/asf/hbase/blob/f5e2a823/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
index 2f99cd5..9054aa9 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
@@ -211,6 +211,7 @@ public class TestCoprocessorScanPolicy {
     // should be gone now
     assertEquals(0, r.size());
     t.close();
+    EnvironmentEdgeManager.reset();
   }
 
   public static class ScanObserver extends BaseRegionObserver {

http://git-wip-us.apache.org/repos/asf/hbase/blob/f5e2a823/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSTableDescriptors.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSTableDescriptors.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSTableDescriptors.java
index df01d71..0bd412d 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSTableDescriptors.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSTableDescriptors.java
@@ -261,7 +261,7 @@ public class TestFSTableDescriptors {
       htds.createTableDescriptor(htd);
     }
     // add hbase:meta
-    HTableDescriptor htd = new HTableDescriptor(HTableDescriptor.META_TABLEDESC.getTableName());
+    HTableDescriptor htd = new HTableDescriptor(TableName.META_TABLE_NAME);
     htds.createTableDescriptor(htd);
 
     assertTrue(htds.getAll().size() == count + 1);

http://git-wip-us.apache.org/repos/asf/hbase/blob/f5e2a823/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
index c4ed3ee..4083bea 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
@@ -37,8 +37,6 @@ import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.util.Random;
-import java.util.Map.Entry;
 import java.util.NavigableMap;
 import java.util.Set;
 import java.util.concurrent.Callable;
@@ -69,7 +67,6 @@ import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.TableExistsException;
 import org.apache.hadoop.hbase.testclassification.LargeTests;
 import org.apache.hadoop.hbase.MiniHBaseCluster;
-import org.apache.hadoop.hbase.RegionLocations;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.MetaTableAccessor;
@@ -84,12 +81,10 @@ import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HConnection;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.MetaScanner;
-import org.apache.hadoop.hbase.client.Mutation;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.RegionReplicaUtil;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.ResultScanner;
-import org.apache.hadoop.hbase.client.RowMutations;
 import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.client.Table;
 import org.apache.hadoop.hbase.io.hfile.TestHFile;
@@ -164,6 +159,7 @@ public class TestHBaseFsck {
     conf.setInt("hbase.hconnection.threads.max", 2 * POOL_SIZE);
     conf.setInt("hbase.hconnection.threads.core", POOL_SIZE);
     conf.setInt("hbase.hbck.close.timeout", 2 * REGION_ONLINE_TIMEOUT);
+    conf.setInt(HConstants.HBASE_RPC_TIMEOUT_KEY, 2 * REGION_ONLINE_TIMEOUT);
     TEST_UTIL.startMiniCluster(3);
 
     tableExecutorService = new ThreadPoolExecutor(1, POOL_SIZE, 60, TimeUnit.SECONDS,
@@ -1356,7 +1352,7 @@ public class TestHBaseFsck {
     HBaseFsck hbck = doFsck(conf, false);
     assertErrors(hbck, new ERROR_CODE[] {ERROR_CODE.NOT_IN_HDFS,
         ERROR_CODE.NOT_IN_HDFS, ERROR_CODE.NOT_IN_HDFS,
-        ERROR_CODE.NOT_IN_HDFS,});
+        ERROR_CODE.NOT_IN_HDFS, ERROR_CODE.ORPHAN_TABLE_STATE, });
     // holes are separate from overlap groups
     assertEquals(0, hbck.getOverlapGroups(table).size());
 
@@ -1399,6 +1395,34 @@ public class TestHBaseFsck {
   }
 
   /**
+   * when the hbase.version file missing, It is fix the fault.
+   */
+  @Test (timeout=180000)
+  public void testNoTableState() throws Exception {
+    // delete the hbase.version file
+    TableName table =
+        TableName.valueOf("testNoTableState");
+    try {
+      setupTable(table);
+      // make sure data in regions, if in wal only there is no data loss
+      admin.flush(table);
+
+      MetaTableAccessor.deleteTableState(TEST_UTIL.getConnection(), table);
+
+      // test
+      HBaseFsck hbck = doFsck(conf, false);
+      assertErrors(hbck, new ERROR_CODE[] { ERROR_CODE.NO_TABLE_STATE });
+      // fix table state missing
+      doFsck(conf, true);
+
+      assertNoErrors(doFsck(conf, false));
+      assertTrue(TEST_UTIL.getHBaseAdmin().isTableEnabled(table));
+    } finally {
+      cleanupTable(table);
+    }
+  }
+
+  /**
    * The region is not deployed when the table is disabled.
    */
   @Test (timeout=180000)
@@ -2405,55 +2429,6 @@ public class TestHBaseFsck {
     writeLock.release(); // release for clean state
   }
 
-  /**
-   * Test orphaned table ZNode (for table states)
-   */
-  @Test
-  public void testOrphanedTableZNode() throws Exception {
-    TableName table = TableName.valueOf("testOrphanedZKTableEntry");
-
-    try {
-      TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager().getTableStateManager()
-      .setTableState(table, ZooKeeperProtos.Table.State.ENABLING);
-
-      try {
-        setupTable(table);
-        Assert.fail(
-          "Create table should fail when its ZNode has already existed with ENABLING state.");
-      } catch(TableExistsException t) {
-        //Expected exception
-      }
-      // The setup table was interrupted in some state that needs to some cleanup.
-      try {
-        cleanupTable(table);
-      } catch (IOException e) {
-        // Because create table failed, it is expected that the cleanup table would
-        // throw some exception.  Ignore and continue.
-      }
-
-      HBaseFsck hbck = doFsck(conf, false);
-      assertTrue(hbck.getErrors().getErrorList().contains(ERROR_CODE.ORPHANED_ZK_TABLE_ENTRY));
-
-      // fix the orphaned ZK entry
-      hbck = doFsck(conf, true);
-
-      // check that orpahned ZK table entry is gone.
-      hbck = doFsck(conf, false);
-      assertFalse(hbck.getErrors().getErrorList().contains(ERROR_CODE.ORPHANED_ZK_TABLE_ENTRY));
-      // Now create table should succeed.
-      setupTable(table);
-    } finally {
-      // This code could be called that either a table was created successfully or set up
-      // table failed in some unknown state.  Therefore, clean up can either succeed or fail.
-      try {
-        cleanupTable(table);
-      } catch (IOException e) {
-        // The cleanup table would throw some exception if create table failed in some state.
-        // Ignore this exception
-      }
-    }
-  }
-
   @Test (timeout=180000)
   public void testMetaOffline() throws Exception {
     // check no errors

http://git-wip-us.apache.org/repos/asf/hbase/blob/f5e2a823/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/OfflineMetaRebuildTestCore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/OfflineMetaRebuildTestCore.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/OfflineMetaRebuildTestCore.java
index 744240e..5be4b1e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/OfflineMetaRebuildTestCore.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/OfflineMetaRebuildTestCore.java
@@ -35,6 +35,9 @@ import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.client.HConnection;
+import org.apache.hadoop.hbase.client.HConnectionManager;
+import org.apache.hadoop.hbase.client.TableState;
 import org.apache.hadoop.hbase.testclassification.LargeTests;
 import org.apache.hadoop.hbase.NamespaceDescriptor;
 import org.apache.hadoop.hbase.ServerName;
@@ -229,7 +232,6 @@ public class OfflineMetaRebuildTestCore {
     out.write(hri.toDelimitedByteArray());
     out.close();
 
-    // add to meta.
     MetaTableAccessor.addRegionToMeta(meta, hri);
     meta.close();
     return hri;
@@ -284,16 +286,9 @@ public class OfflineMetaRebuildTestCore {
    * @return # of entries in meta.
    */
   protected int scanMeta() throws IOException {
-    int count = 0;
-    HTable meta = new HTable(conf, TableName.META_TABLE_NAME);
-    ResultScanner scanner = meta.getScanner(new Scan());
-    LOG.info("Table: " + Bytes.toString(meta.getTableName()));
-    for (Result res : scanner) {
-      LOG.info(Bytes.toString(res.getRow()));
-      count++;
-    }
-    meta.close();
-    return count;
+    LOG.info("Scanning META");
+    MetaTableAccessor.fullScanMetaAndPrint(TEST_UTIL.getConnection());
+    return MetaTableAccessor.fullScanRegions(TEST_UTIL.getConnection()).size();
   }
 
   protected HTableDescriptor[] getTables(final Configuration configuration) throws IOException
{

http://git-wip-us.apache.org/repos/asf/hbase/blob/f5e2a823/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 f4a035f..a4ddc13 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
@@ -20,11 +20,13 @@ package org.apache.hadoop.hbase.util.hbck;
 import static org.apache.hadoop.hbase.util.hbck.HbckTestingUtil.assertErrors;
 import static org.apache.hadoop.hbase.util.hbck.HbckTestingUtil.doFsck;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import java.util.Arrays;
 
 import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.testclassification.MediumTests;
 import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.Connection;
@@ -57,24 +59,29 @@ public class TestOfflineMetaRebuildBase extends OfflineMetaRebuildTestCore
{
 
     // shutdown the minicluster
     TEST_UTIL.shutdownMiniHBaseCluster();
-    TEST_UTIL.shutdownMiniZKCluster();
 
     // rebuild meta table from scratch
     HBaseFsck fsck = new HBaseFsck(conf);
     assertTrue(fsck.rebuildMeta(false));
 
     // bring up the minicluster
-    TEST_UTIL.startMiniZKCluster();
     TEST_UTIL.restartHBaseCluster(3);
     try (Connection connection = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration()))
{
       Admin admin = connection.getAdmin();
-      admin.enableTable(table);
+      if (admin.isTableDisabled(table))
+        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());
+      assertEquals(5, scanMeta()); // including table state rows
+      TableName[] tableNames = TEST_UTIL.getHBaseAdmin().listTableNames();
+      for (TableName tableName : tableNames) {
+        HTableDescriptor tableDescriptor = TEST_UTIL.getHBaseAdmin().getTableDescriptor(tableName);
+        assertNotNull(tableDescriptor);
+        assertTrue(TEST_UTIL.getHBaseAdmin().isTableEnabled(tableName));
+      }
       HTableDescriptor[] htbls = admin.listTables();
       LOG.info("Tables present after restart: " + Arrays.toString(htbls));
       assertEquals(1, htbls.length);

http://git-wip-us.apache.org/repos/asf/hbase/blob/f5e2a823/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 f6fd4f1..7bdc6f2 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
@@ -61,7 +61,6 @@ public class TestOfflineMetaRebuildHole extends OfflineMetaRebuildTestCore
{
 
     // shutdown the minicluster
     TEST_UTIL.shutdownMiniHBaseCluster();
-    TEST_UTIL.shutdownMiniZKCluster();
 
     // attempt to rebuild meta table from scratch
     HBaseFsck fsck = new HBaseFsck(conf);
@@ -69,7 +68,6 @@ public class TestOfflineMetaRebuildHole extends OfflineMetaRebuildTestCore
{
     fsck.close();
 
     // bring up the minicluster
-    TEST_UTIL.startMiniZKCluster(); // tables seem enabled by default
     TEST_UTIL.restartHBaseCluster(3);
 
     ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(TEST_UTIL);

http://git-wip-us.apache.org/repos/asf/hbase/blob/f5e2a823/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 69a962b..b8ca7d7 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
@@ -66,7 +66,6 @@ public class TestOfflineMetaRebuildOverlap extends OfflineMetaRebuildTestCore
{
 
     // shutdown the minicluster
     TEST_UTIL.shutdownMiniHBaseCluster();
-    TEST_UTIL.shutdownMiniZKCluster();
 
     // attempt to rebuild meta table from scratch
     HBaseFsck fsck = new HBaseFsck(conf);
@@ -77,7 +76,6 @@ public class TestOfflineMetaRebuildOverlap extends OfflineMetaRebuildTestCore
{
     assertEquals(3, problems.size());
 
     // bring up the minicluster
-    TEST_UTIL.startMiniZKCluster(); // tables seem enabled by default
     TEST_UTIL.restartHBaseCluster(3);
 
     ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(TEST_UTIL);

http://git-wip-us.apache.org/repos/asf/hbase/blob/f5e2a823/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKTableStateManager.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKTableStateManager.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKTableStateManager.java
deleted file mode 100644
index e81c89f..0000000
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKTableStateManager.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.zookeeper;
-
-import java.io.IOException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.apache.hadoop.hbase.Abortable;
-import org.apache.hadoop.hbase.CoordinatedStateException;
-import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.testclassification.MediumTests;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.TableStateManager;
-import org.apache.zookeeper.KeeperException;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.Table;
-
-@Category(MediumTests.class)
-public class TestZKTableStateManager {
-  private static final Log LOG = LogFactory.getLog(TestZKTableStateManager.class);
-  private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
-
-  @BeforeClass
-  public static void setUpBeforeClass() throws Exception {
-    TEST_UTIL.startMiniZKCluster();
-  }
-
-  @AfterClass
-  public static void tearDownAfterClass() throws Exception {
-    TEST_UTIL.shutdownMiniZKCluster();
-  }
-
-  @Test
-  public void testTableStates()
-      throws CoordinatedStateException, IOException, KeeperException, InterruptedException
{
-    final TableName name =
-        TableName.valueOf("testDisabled");
-    Abortable abortable = new Abortable() {
-      @Override
-      public void abort(String why, Throwable e) {
-        LOG.info(why, e);
-      }
-
-      @Override
-      public boolean isAborted() {
-        return false;
-      }
-
-    };
-    ZooKeeperWatcher zkw = new ZooKeeperWatcher(TEST_UTIL.getConfiguration(),
-      name.getNameAsString(), abortable, true);
-    TableStateManager zkt = new ZKTableStateManager(zkw);
-    assertFalse(zkt.isTableState(name, Table.State.ENABLED));
-    assertFalse(zkt.isTableState(name, Table.State.DISABLING));
-    assertFalse(zkt.isTableState(name, Table.State.DISABLED));
-    assertFalse(zkt.isTableState(name, Table.State.ENABLING));
-    assertFalse(zkt.isTableState(name, Table.State.DISABLED, Table.State.DISABLING));
-    assertFalse(zkt.isTableState(name, Table.State.DISABLED, Table.State.ENABLING));
-    assertFalse(zkt.isTablePresent(name));
-    zkt.setTableState(name, Table.State.DISABLING);
-    assertTrue(zkt.isTableState(name, Table.State.DISABLING));
-    assertTrue(zkt.isTableState(name, Table.State.DISABLED, Table.State.DISABLING));
-    assertFalse(zkt.getTablesInStates(Table.State.DISABLED).contains(name));
-    assertTrue(zkt.isTablePresent(name));
-    zkt.setTableState(name, Table.State.DISABLED);
-    assertTrue(zkt.isTableState(name, Table.State.DISABLED));
-    assertTrue(zkt.isTableState(name, Table.State.DISABLED, Table.State.DISABLING));
-    assertFalse(zkt.isTableState(name, Table.State.DISABLING));
-    assertTrue(zkt.getTablesInStates(Table.State.DISABLED).contains(name));
-    assertTrue(zkt.isTablePresent(name));
-    zkt.setTableState(name, Table.State.ENABLING);
-    assertTrue(zkt.isTableState(name, Table.State.ENABLING));
-    assertTrue(zkt.isTableState(name, Table.State.DISABLED, Table.State.ENABLING));
-    assertFalse(zkt.isTableState(name, Table.State.DISABLED));
-    assertFalse(zkt.getTablesInStates(Table.State.DISABLED).contains(name));
-    assertTrue(zkt.isTablePresent(name));
-    zkt.setTableState(name, Table.State.ENABLED);
-    assertTrue(zkt.isTableState(name, Table.State.ENABLED));
-    assertFalse(zkt.isTableState(name, Table.State.ENABLING));
-    assertTrue(zkt.isTablePresent(name));
-    zkt.setDeletedTable(name);
-    assertFalse(zkt.isTableState(name, Table.State.ENABLED));
-    assertFalse(zkt.isTableState(name, Table.State.DISABLING));
-    assertFalse(zkt.isTableState(name, Table.State.DISABLED));
-    assertFalse(zkt.isTableState(name, Table.State.ENABLING));
-    assertFalse(zkt.isTableState(name, Table.State.DISABLED, Table.State.DISABLING));
-    assertFalse(zkt.isTableState(name, Table.State.DISABLED, Table.State.ENABLING));
-    assertFalse(zkt.isTablePresent(name));
-  }
-}


Mime
View raw message