@AfterClass public static void tearDownAfterClass() throws Exception { TEST_UTIL_PEER.shutdownMiniHBaseCluster(); TEST_UTIL.shutdownMiniHBaseCluster(); TEST_UTIL.shutdownMiniDFSCluster(); }
@After public void tearDown() throws Exception { TEST_UTIL.shutdownMiniHBaseCluster(); }
private void restartHBaseCluster() throws Exception { LOG.info("\n\nShutting down cluster"); TEST_UTIL.shutdownMiniHBaseCluster(); LOG.info("\n\nSleeping a bit"); Thread.sleep(2000); TEST_UTIL.restartHBaseCluster(NUM_SLAVES_BASE - 1); initialize(); } }
/** * Stops mini hbase, zk, and hdfs clusters. * @throws IOException * @see #startMiniCluster(int) */ public void shutdownMiniCluster() throws Exception { LOG.info("Shutting down minicluster"); shutdownMiniHBaseCluster(); shutdownMiniDFSCluster(); shutdownMiniZKCluster(); cleanupTestDir(); miniClusterRunning = false; LOG.info("Minicluster is down"); }
@After public void after() throws Exception { TEST_UTIL.shutdownMiniHBaseCluster(); TEST_UTIL.getTestFileSystem().delete(FSUtils.getRootDir(TEST_UTIL.getConfiguration()), true); ZKUtil.deleteNodeRecursively(TEST_UTIL.getZooKeeperWatcher(), "/hbase"); }
@Test public void testConnectionRideOverClusterRestart() throws IOException, InterruptedException { Configuration config = new Configuration(TEST_UTIL.getConfiguration()); final TableName tableName = TableName.valueOf(name.getMethodName()); TEST_UTIL.createTable(tableName, new byte[][] {FAM_NAM}).close(); Connection connection = ConnectionFactory.createConnection(config); Table table = connection.getTable(tableName); // this will cache the meta location and table's region location table.get(new Get(Bytes.toBytes("foo"))); // restart HBase TEST_UTIL.shutdownMiniHBaseCluster(); TEST_UTIL.restartHBaseCluster(2); // this should be able to discover new locations for meta and table's region table.get(new Get(Bytes.toBytes("foo"))); TEST_UTIL.deleteTable(tableName); table.close(); connection.close(); }
private void mimicSyncUpAfterDelete() throws Exception { LOG.debug("mimicSyncUpAfterDelete"); utility2.shutdownMiniHBaseCluster(); 101, rowCount_ht2Source); utility1.shutdownMiniHBaseCluster(); utility2.restartHBaseCluster(1);
private void mimicSyncUpAfterPut() throws Exception { LOG.debug("mimicSyncUpAfterPut"); utility1.restartHBaseCluster(1); utility2.shutdownMiniHBaseCluster(); assertEquals("t2_syncup has 202 rows on source", 202, rowCount_ht2Source); utility1.shutdownMiniHBaseCluster(); utility2.restartHBaseCluster(1);
TEST_UTIL.shutdownMiniHBaseCluster();
utility2.shutdownMiniHBaseCluster();
private void mimicSyncUpAfterBulkLoad(Iterator<String> randomHFileRangeListIterator) throws Exception { LOG.debug("mimicSyncUpAfterBulkLoad"); utility2.shutdownMiniHBaseCluster(); rowCount_ht2Source); utility1.shutdownMiniHBaseCluster(); utility2.restartHBaseCluster(1);
@After public void after() throws Exception { try { TEST_UTIL.getHBaseCluster().waitForActiveAndReadyMaster(10000); // Some regionserver could fail to delete its znode. // So shutdown could hang. Let's kill them all instead. TEST_UTIL.getHBaseCluster().killAll(); // Still need to clean things up TEST_UTIL.shutdownMiniHBaseCluster(); } finally { TEST_UTIL.getTestFileSystem().delete(FSUtils.getRootDir(TEST_UTIL.getConfiguration()), true); ZKUtil.deleteNodeRecursively(TEST_UTIL.getZooKeeperWatcher(), "/hbase"); } }
t.put(p); TEST_UTIL.shutdownMiniHBaseCluster();
private void testScanner(HBaseTestingUtility util, String snapshotName, int numRegions, boolean shutdownCluster) throws Exception { setupCluster(); TableName tableName = TableName.valueOf("testScanner"); try { createTableAndSnapshot(util, tableName, snapshotName, numRegions); if (shutdownCluster) { util.shutdownMiniHBaseCluster(); } Path restoreDir = util.getDataTestDirOnTestFS(snapshotName); Scan scan = new Scan(bbb, yyy); // limit the scan TableSnapshotScanner scanner = new TableSnapshotScanner(UTIL.getConfiguration(), restoreDir, snapshotName, scan); verifyScanner(scanner, bbb, yyy); scanner.close(); } finally { if (!shutdownCluster) { util.getAdmin().deleteSnapshot(snapshotName); util.deleteTable(tableName); tearDownCluster(); } } }
utility1.shutdownMiniHBaseCluster(); utility1.startMiniHBaseCluster();
@Test public void testHBaseConnectionManager() throws Exception{ setColumnWidth(8); runHBaseSQLVerifyCount("SELECT\n" + "row_key\n" + "FROM\n" + " hbase.`[TABLE_NAME]` tableName", 8); /* * Simulate HBase connection close and ensure that the connection * will be reestablished automatically. */ storagePlugin.getConnection().close(); runHBaseSQLVerifyCount("SELECT\n" + "row_key\n" + "FROM\n" + " hbase.`[TABLE_NAME]` tableName", 8); /* * Simulate HBase cluster restart and ensure that running query against * HBase does not require Drill cluster restart. */ HBaseTestsSuite.getHBaseTestingUtility().shutdownMiniHBaseCluster(); HBaseTestsSuite.getHBaseTestingUtility().restartHBaseCluster(1); runHBaseSQLVerifyCount("SELECT\n" + "row_key\n" + "FROM\n" + " hbase.`[TABLE_NAME]` tableName", 8); }