@Override public void disableTable(String tableName) throws IOException { adm.disableTable(tableName); }
@Override public void disableTable(String tableName) throws IOException { adm.disableTable(tableName); }
@Override public void disableTable(String tableName) throws IOException { adm.disableTable(tableName); }
public void disableTable(String tableName) { try (HBaseAdmin admin = (HBaseAdmin) getConnection().getAdmin()) { admin.disableTable(tableName); } catch (IOException e) { logger.error(e.getMessage(), e); throw new RuntimeException(e); } }
public Object call() throws Exception { logger.info("Deleting HBase table " + htableName); if (hbaseAdmin.tableExists(htableName)) { if (hbaseAdmin.isTableEnabled(htableName)) { hbaseAdmin.disableTable(htableName); } hbaseAdmin.deleteTable(htableName); logger.info("Deleted HBase table " + htableName); } else { logger.info("HBase table" + htableName + " does not exist"); } return null; } }
@Override public HTableDescriptor[] disableTables(Pattern pattern) throws IOException { List<HTableDescriptor> failed = new LinkedList<>(); for (HTableDescriptor table : listTables(pattern)) { if (isTableEnabled(table.getTableName())) { try { disableTable(table.getTableName()); } catch (IOException ex) { LOG.info("Failed to disable table " + table.getTableName(), ex); failed.add(table); } } } return failed.toArray(new HTableDescriptor[failed.size()]); }
String tableName = (String) opt.params[0]; HTableDescriptor desc = hbaseAdmin.getTableDescriptor(TableName.valueOf(tableName)); hbaseAdmin.disableTable(tableName); desc.setValue(IRealizationConstants.HTableTag, srcConfig.getMetadataUrlPrefix()); hbaseAdmin.modifyTable(tableName, desc);
public void fixInconsistent() throws IOException { if (ifFix == true) { for (String segFullName : inconsistentHTables) { String[] sepNameList = StringUtil.splitByComma(segFullName); HTableDescriptor desc = hbaseAdmin.getTableDescriptor(TableName.valueOf(sepNameList[0])); logger.info("Change the host of htable " + sepNameList[0] + "belonging to cube " + sepNameList[1] + " from " + desc.getValue(IRealizationConstants.HTableTag) + " to " + dstCfg.getMetadataUrlPrefix()); hbaseAdmin.disableTable(sepNameList[0]); desc.setValue(IRealizationConstants.HTableTag, dstCfg.getMetadataUrlPrefix()); hbaseAdmin.modifyTable(sepNameList[0], desc); hbaseAdmin.enableTable(sepNameList[0]); } } else { logger.info("------ Inconsistent HTables Needed To Be Fixed ------"); for (String hTable : inconsistentHTables) { String[] sepNameList = StringUtil.splitByComma(hTable); logger.info(sepNameList[0] + " belonging to cube " + sepNameList[1]); } logger.info("----------------------------------------------------"); } }
private void truncateTable(HBaseTestingUtility util, TableName tablename) throws IOException { HBaseAdmin admin = util.getHBaseAdmin(); admin.disableTable(tableName); admin.truncateTable(tablename, false); }
@Test public void testWithEmptyFirstAndLastRegion() throws Exception { HBaseAdmin admin = (HBaseAdmin) HBaseTestsSuite.getAdmin(); TableName tableName = TableName.valueOf("drill_ut_empty_regions"); try (Table table = HBaseTestsSuite.getConnection().getTable(tableName);) { HTableDescriptor desc = new HTableDescriptor(tableName); desc.addFamily(new HColumnDescriptor("f")); admin.createTable(desc, Arrays.copyOfRange(TestTableGenerator.SPLIT_KEYS, 0, 2)); Put p = new Put("b".getBytes()); p.addColumn("f".getBytes(), "c".getBytes(), "1".getBytes()); table.put(p); setColumnWidths(new int[] {8, 15}); runHBaseSQLVerifyCount("SELECT *\n" + "FROM\n" + " hbase.`" + tableName + "` tableName\n", 1); } finally { try { admin.disableTable(tableName); admin.deleteTable(tableName); } catch (Exception e) { } // ignore } }
/** * Verify backup system table snapshot. * * @throws Exception if an operation on the table fails */ // @Test public void _testBackupRestoreSystemTable() throws Exception { LOG.info("test snapshot system table"); TableName backupSystem = BackupSystemTable.getTableName(conf1); HBaseAdmin hba = TEST_UTIL.getHBaseAdmin(); String snapshotName = "sysTable"; hba.snapshot(snapshotName, backupSystem); hba.disableTable(backupSystem); hba.restoreSnapshot(snapshotName); hba.enableTable(backupSystem); hba.close(); } }
System.out.println("CHANGE_HTABLE_HOST, table name: " + tableName); HTableDescriptor desc = hbaseAdmin.getTableDescriptor(TableName.valueOf(tableName)); hbaseAdmin.disableTable(tableName); desc.setValue(IRealizationConstants.HTableTag, dstConfig.getMetadataUrlPrefix()); hbaseAdmin.modifyTable(tableName, desc);
public static void prepareTestData() throws Exception { try { util.getHBaseAdmin().disableTable(TABLE); util.getHBaseAdmin().deleteTable(TABLE); } catch (Exception e) { // ignore table not found } Table table = util.createTable(TABLE, FAM); HRegionInfo hRegionInfo = new HRegionInfo(table.getName()); region = util.createLocalHRegion(hRegionInfo, table.getTableDescriptor()); gtInfo = newInfo(); GridTable gridTable = newTable(gtInfo); IGTScanner scanner = gridTable.scan(new GTScanRequestBuilder().setInfo(gtInfo).setRanges(null) .setDimensions(null).setFilterPushDown(null).createGTScanRequest()); for (GTRecord record : scanner) { byte[] value = record.exportColumns(gtInfo.getPrimaryKey()).toBytes(); byte[] key = new byte[RowConstants.ROWKEY_SHARD_AND_CUBOID_LEN + value.length]; System.arraycopy(Bytes.toBytes(baseCuboid), 0, key, RowConstants.ROWKEY_SHARDID_LEN, RowConstants.ROWKEY_CUBOIDID_LEN); System.arraycopy(value, 0, key, RowConstants.ROWKEY_SHARD_AND_CUBOID_LEN, value.length); Put put = new Put(key); put.addColumn(FAM, COL_M, record.exportColumns(gtInfo.getColumnBlock(1)).toBytes()); region.put(put); } }
admin.disableTable(TEST_TABLE); admin.restoreSnapshot(snapshotName1, false, false); admin.enableTable(TEST_TABLE); admin.disableTable(TEST_TABLE); admin.restoreSnapshot(snapshotName1, false, true); admin.enableTable(TEST_TABLE);
admin.disableTable(table2); admin.deleteTable(table2);
public void dropTable(String tableName) { try { utility.getHBaseAdmin().disableTable(tableName); utility.getHBaseAdmin().deleteTable(tableName); } catch (IOException e) { logger.error(e.getMessage()); } }
private void alter() throws IOException { Configuration conf = HBaseConfiguration.create(); HBaseAdmin hbaseAdmin = new HBaseAdmin(conf); HTableDescriptor table = hbaseAdmin.getTableDescriptor(TableName.valueOf(tableName)); hbaseAdmin.disableTable(table.getTableName()); table.setValue(metadataKey, metadataValue); hbaseAdmin.modifyTable(table.getTableName(), table); hbaseAdmin.enableTable(table.getTableName()); hbaseAdmin.close(); }
private static void destroyIndexTable() throws Exception { Properties props = new Properties(TEST_PROPERTIES); ConnectionQueryServices services = DriverManager.getConnection(getUrl(), props).unwrap(PhoenixConnection.class).getQueryServices(); HBaseAdmin admin = services.getAdmin(); try { admin.disableTable(INDEX_TABLE_FULL_NAME); admin.deleteTable(INDEX_TABLE_FULL_NAME); } catch (TableNotFoundException e) { } finally { admin.close(); } }
/** * Test update. * * @throws IOException * Signals that an I/O exception has occurred. */ public void testUpdate() throws IOException { init(); admin.disableTable(TABLE_2); admin.deleteTable(TABLE_2); propertyMap.put(PersistenceProperties.KUNDERA_DDL_AUTO_PREPARE, "update"); assertSchema(); postAssert(); }
@BeforeClass public static void doBeforeTestSetup() throws Exception { HBaseAdmin admin = driver.getConnectionQueryServices(getUrl(), TEST_PROPERTIES).getAdmin(); try { try { admin.disableTable(HBASE_DYNAMIC_COLUMNS_BYTES); admin.deleteTable(HBASE_DYNAMIC_COLUMNS_BYTES); } catch (org.apache.hadoop.hbase.TableNotFoundException e) {} ensureTableCreated(getUrl(), HBASE_DYNAMIC_COLUMNS); initTableValues(); } finally { admin.close(); } }