Package org.apache.hadoop.hbase

Examples of org.apache.hadoop.hbase.MiniHBaseCluster


   * the node as active master.
   * @throws Exception
   */
  @Test(timeout=10000)
  public void testMasterZKSessionRecoveryFailure() throws Exception {
    MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
    HMaster m = cluster.getMaster();
    m.abort("Test recovery from zk session expired",
      new KeeperException.SessionExpiredException());
    assertFalse(m.isStopped());
  }
View Full Code Here


   * Ensures the master can recover the expired zk session.
   * @throws Exception
   */
  @Test(timeout=60000)
  public void testMasterZKSessionRecoverySuccess() throws Exception {
    MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
    HMaster m = cluster.getMaster();
    m.getZooKeeperWatcher().close();
    m.abort("Test recovery from zk session expired",
      new KeeperException.SessionExpiredException());
    assertFalse(m.isStopped());
  }
View Full Code Here

   * expired zookeeper session. Without the HBASE-6046 fix master always tries
   * to assign all the user regions by calling retainAssignment.
   */
  @Test
  public void testRegionAssignmentAfterMasterRecoveryDueToZKExpiry() throws Exception {
    MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
    cluster.startRegionServer();
    HMaster m = cluster.getMaster();
    // now the cluster is up. So assign some regions.
    HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration());
    byte[][] SPLIT_KEYS = new byte[][] { Bytes.toBytes("a"), Bytes.toBytes("b"),
        Bytes.toBytes("c"), Bytes.toBytes("d"), Bytes.toBytes("e"), Bytes.toBytes("f"),
        Bytes.toBytes("g"), Bytes.toBytes("h"), Bytes.toBytes("i"), Bytes.toBytes("j") };
View Full Code Here

   * zookeeper session and an RS goes down.
   */
  @Test(timeout = 60000)
  public void testLogSplittingAfterMasterRecoveryDueToZKExpiry() throws IOException,
      KeeperException, InterruptedException {
    MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
    cluster.startRegionServer();
    HMaster m = cluster.getMaster();
    // now the cluster is up. So assign some regions.
    HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration());
    byte[][] SPLIT_KEYS = new byte[][] { Bytes.toBytes("1"), Bytes.toBytes("2"),
        Bytes.toBytes("3"), Bytes.toBytes("4"), Bytes.toBytes("5") };

    String tableName = "testLogSplittingAfterMasterRecoveryDueToZKExpiry";
    HTableDescriptor htd = new HTableDescriptor(tableName);
    HColumnDescriptor hcd = new HColumnDescriptor("col");
    htd.addFamily(hcd);
    admin.createTable(htd, SPLIT_KEYS);
    ZooKeeperWatcher zooKeeperWatcher = HBaseTestingUtility.getZooKeeperWatcher(TEST_UTIL);
    ZKAssign.blockUntilNoRIT(zooKeeperWatcher);
    HTable table = new HTable(TEST_UTIL.getConfiguration(), tableName);

    Put p = null;
    int numberOfPuts = 0;
    for (numberOfPuts = 0; numberOfPuts < 6; numberOfPuts++) {
      p = new Put(Bytes.toBytes(numberOfPuts));
      p.add(Bytes.toBytes("col"), Bytes.toBytes("ql"), Bytes.toBytes("value" + numberOfPuts));
      table.put(p);
    }
    m.getZooKeeperWatcher().close();
    m.abort("Test recovery from zk session expired", new KeeperException.SessionExpiredException());
    assertFalse(m.isStopped());
    cluster.getRegionServer(0).abort("Aborting");
    // Without patch for HBASE-6046 this test case will always timeout
    // with patch the test case should pass.
    Scan scan = new Scan();
    int numberOfRows = 0;
    ResultScanner scanner = table.getScanner(scan);
View Full Code Here

   */

  @Test(timeout = 180000)
  public void testCreateIndexTableWhenIndexTableAlreadyExist() throws Exception {
    HBaseAdmin admin = UTIL.getHBaseAdmin();
    MiniHBaseCluster cluster = UTIL.getHBaseCluster();
    HMaster master = cluster.getMaster();

    IndexedHTableDescriptor iHtd =
        createIndexedHTableDescriptor("testCreateIndexTableWhenIndexTableAlreadyExist", "cf",
          "index_name", "cf", "cq");
    admin.createTable(iHtd);
View Full Code Here

  }

  @Test(timeout = 180000)
  public void testCreateIndexTableWithOutIndexDetails() throws Exception {
    HBaseAdmin admin = UTIL.getHBaseAdmin();
    MiniHBaseCluster cluster = UTIL.getHBaseCluster();
    HMaster master = cluster.getMaster();

    IndexedHTableDescriptor iHtd =
        new IndexedHTableDescriptor("testCreateIndexTableWithOutIndexDetails");
    admin.createTable(iHtd);
    assertTrue("Table is not created.",
View Full Code Here

  }

  @Test(timeout = 180000)
  public void testCreateIndexTableWhenExistedIndexTableDisabled() throws Exception {
    HBaseAdmin admin = UTIL.getHBaseAdmin();
    MiniHBaseCluster cluster = UTIL.getHBaseCluster();
    HMaster master = cluster.getMaster();

    IndexedHTableDescriptor iHtd =
        createIndexedHTableDescriptor("testCreateIndexTableWhenExistedIndexTableDisabled", "cf",
          "index_name", "cf", "cq");
    char c = 'A';
View Full Code Here

  }

  @Test(timeout = 180000)
  public void testCreateIndexTableWhenExistedTableDisableFailed() throws Exception {
    HBaseAdmin admin = UTIL.getHBaseAdmin();
    MiniHBaseCluster cluster = UTIL.getMiniHBaseCluster();
    HMaster master = cluster.getMaster();
    HTableDescriptor htd =
        new HTableDescriptor("testCreateIndexTableWhenExistedTableDisableFailed");
    admin.createTable(htd);

    IndexedHTableDescriptor iHtd =
View Full Code Here

        createIndexedHTableDescriptor("testIndexTableCreationAfterMasterRestart", "cf",
          "index_name", "cf", "cq");
    admin.createTable(iHtd);
    admin.disableTable("testIndexTableCreationAfterMasterRestart" + Constants.INDEX_TABLE_SUFFIX);
    admin.deleteTable("testIndexTableCreationAfterMasterRestart" + Constants.INDEX_TABLE_SUFFIX);
    MiniHBaseCluster cluster = UTIL.getHBaseCluster();
    cluster.abortMaster(0);
    cluster.waitOnMaster(0);
    HMaster master = cluster.startMaster().getMaster();
    cluster.waitForActiveAndReadyMaster();
    String indexTableName =
        "testIndexTableCreationAfterMasterRestart" + Constants.INDEX_TABLE_SUFFIX;

    assertTrue("Index tables is not created.", admin.isTableAvailable(indexTableName));
  }
View Full Code Here

    HBaseAdmin admin = new HBaseAdmin(UTIL.getConfiguration());

    HTableDescriptor htd =
        new HTableDescriptor("testIndexTableCreationAlongWithNormalTablesAfterMasterRestart");
    admin.createTable(htd);
    MiniHBaseCluster cluster = UTIL.getHBaseCluster();
    cluster.abortMaster(0);
    cluster.waitOnMaster(0);
    HMaster master = cluster.startMaster().getMaster();
    cluster.waitForActiveAndReadyMaster();

    boolean tableExist =
        MetaReader.tableExists(master.getCatalogTracker(),
          "testIndexTableCreationAlongWithNormalTablesAfterMasterRestart"
              + Constants.INDEX_TABLE_SUFFIX);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.MiniHBaseCluster

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.