Refine search
public Object call() throws Exception { logger.info("Deleting HBase table " + htableName); if (hbaseAdmin.tableExists(TableName.valueOf(htableName))) { if (hbaseAdmin.isTableEnabled(TableName.valueOf(htableName))) { hbaseAdmin.disableTable(TableName.valueOf(htableName)); } hbaseAdmin.deleteTable(TableName.valueOf(htableName)); logger.info("Deleted HBase table " + htableName); } else { logger.info("HBase table" + htableName + " does not exist"); } return null; } }
@Test public void testEnableReplicationWhenSlaveClusterDoesntHaveTable() throws Exception { admin1.disableTableReplication(tableName); admin2.disableTable(tableName); admin2.deleteTable(tableName); assertFalse(admin2.tableExists(tableName)); admin1.enableTableReplication(tableName); assertTrue(admin2.tableExists(tableName)); }
private static void deleteTable(Configuration conf, String[] args) { TableName tableName = TableName.valueOf(args[0]); try (Connection connection = ConnectionFactory.createConnection(conf); Admin admin = connection.getAdmin()) { try { admin.disableTable(tableName); } catch (TableNotEnabledException e) { LOG.debug("Dry mode: Table: " + tableName + " already disabled, so just deleting it."); } admin.deleteTable(tableName); } catch (IOException e) { LOG.error(format("***Dry run: Failed to delete table '%s'.***%n%s", tableName, e.toString())); return; } LOG.info(format("Dry run: Deleted table '%s'.", tableName)); }
private void dropTable(Admin admin, TableName tn) throws Exception { admin.disableTable(tn); admin.deleteTable(tn); } }
private static void destroy(Admin admin, TableName tableName) throws IOException { try { admin.disableTable(tableName); admin.deleteTable(tableName); } catch (TableNotFoundException tnfe) { /* Ignore */ } } }
public static void deleteHTable(TableName tableName) throws IOException { Admin admin = HBaseConnection.get(KylinConfig.getInstanceFromEnv().getStorageUrl()).getAdmin(); try { if (admin.tableExists(tableName)) { logger.info("disabling hbase table " + tableName); admin.disableTable(tableName); logger.info("deleting hbase table " + tableName); admin.deleteTable(tableName); } } finally { IOUtils.closeQuietly(admin); } }
@After public void afterTestMethod() throws Exception { admin.disableTable(tableName); admin.deleteTable(tableName); }
private static void deleteTable() { if (admin != null) { try { admin.disableTable(name); admin.deleteTable(name); } catch (IOException e) { assertNull("Exception found deleting the table", e); } } }
/** * Drop an existing table * @param tableName existing table */ public void deleteTable(TableName tableName) throws IOException { try { getAdmin().disableTable(tableName); } catch (TableNotEnabledException e) { LOG.debug("Table: " + tableName + " already disabled, so just deleting it."); } getAdmin().deleteTable(tableName); }
private void disableAndDeleteTable(TableName tableName) throws IOException { HTU.getAdmin().disableTable(tableName); HTU.getAdmin().deleteTable(tableName); }
@After public void tearDown() throws Exception { Admin admin = TEST_UTIL.getAdmin(); for (String table : new String[] {TABLE1, TABLE2}) { TableName t = TableName.valueOf(table); if (admin.tableExists(t)) { admin.disableTable(t); admin.deleteTable(t); } } conf.set("hbase.rest.readonly", "false"); }
@Override public void rollbackCreateTable(Table table) throws MetaException { String tableName = getHBaseTableName(table); boolean isPurge = !MetaStoreUtils.isExternalTable(table) || MetaStoreUtils.isExternalTablePurge(table); try { if (isPurge && getHBaseAdmin().tableExists(TableName.valueOf(tableName))) { // we have created an HBase table, so we delete it to roll back; if (getHBaseAdmin().isTableEnabled(TableName.valueOf(tableName))) { getHBaseAdmin().disableTable(TableName.valueOf(tableName)); } getHBaseAdmin().deleteTable(TableName.valueOf(tableName)); } } catch (IOException ie) { throw new MetaException(StringUtils.stringifyException(ie)); } }
private static void deleteTables() { if (admin != null) { for (TableName tableName: createdTables){ try { if (admin.tableExists(tableName)) { admin.disableTable(tableName); admin.deleteTable(tableName); } } catch (IOException e) { assertNull("Exception found deleting the table", e); } } } }
@After public void tearDown() throws IOException { LOG.info("Cleaning up after test."); if (admin.tableExists(TABLE_NAME)) { if (admin.isTableEnabled(TABLE_NAME)) admin.disableTable(TABLE_NAME); admin.deleteTable(TABLE_NAME); } LOG.info("Restoring cluster."); UTIL.restoreCluster(); LOG.info("Cluster restored."); }
@Before public void setUp() throws Exception { LOG.info(String.format("Initializing cluster with %d region servers.", REGION_SERVER_COUNT)); UTIL.initializeCluster(REGION_SERVER_COUNT); LOG.info("Cluster initialized"); admin = UTIL.getAdmin(); if (admin.tableExists(TABLE_NAME)) { LOG.info(String.format("Deleting existing table %s.", TABLE_NAME)); if (admin.isTableEnabled(TABLE_NAME)) admin.disableTable(TABLE_NAME); admin.deleteTable(TABLE_NAME); LOG.info(String.format("Existing table %s deleted.", TABLE_NAME)); } LOG.info("Cluster ready"); }
@After public void cleanupTestTable() throws Exception { UTIL.getAdmin().disableTable(primaryTable); UTIL.getAdmin().deleteTable(primaryTable); UTIL.getAdmin().disableTable(otherTable); UTIL.getAdmin().deleteTable(otherTable); }
@After public void tearDownAfterTest() throws IOException { try (Admin admin = UTIL.getAdmin()) { if (admin.isTableEnabled(tableName)) { admin.disableTable(tableName); } admin.deleteTable(tableName); } }
@After public void tearDown() throws IOException { Admin admin = UTIL.getAdmin(); if (admin.tableExists(NAME)) { admin.disableTable(NAME); admin.deleteTable(NAME); } }
@After public void cleanup() throws Exception { // cleanup CheckWasRunConstraint.wasRun = false; util.getAdmin().disableTable(tableName); util.getAdmin().deleteTable(tableName); }
@AfterClass public static void tearDown() throws Exception { UTIL.getAdmin().disableTable(TABLE_DONOT_RETRY); UTIL.getAdmin().disableTable(TABLE_RETRY); UTIL.getAdmin().deleteTable(TABLE_DONOT_RETRY); UTIL.getAdmin().deleteTable(TABLE_RETRY); UTIL.shutdownMiniCluster(); }