@Override public Void call() throws Exception { HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get(); // register it for close, after all Futures are complete toClose.add(ddlExecutor); Map<String, Future<?>> futures = upgradeUserTables(namespaceMeta, executor, ddlExecutor); allFutures.putAll(futures); return null; } });
@Override public void truncate() throws IOException { try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) { tableUtil.truncateTable(ddlExecutor, tableId); } }
@Override public void truncate() throws IOException { try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) { tableUtil.truncateTable(ddlExecutor, tableId); } }
@Override public void drop() throws IOException { try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) { tableUtil.dropTable(ddlExecutor, tableId); } }
@Override public void drop() throws IOException { try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) { tableUtil.dropTable(ddlExecutor, tableId); } }
private void checkHBaseDDLExtension(Set<String> problemKeys) { HBaseDDLExecutorFactory factory = new HBaseDDLExecutorFactory(cConf, hConf); try { factory.get(); } catch (Exception e) { LOG.error(e.getMessage()); problemKeys.add(Constants.HBaseDDLExecutor.EXTENSIONS_DIR); } }
@Override public void truncate() throws IOException { try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) { tableUtil.truncateTable(ddlExecutor, tableId); } }
@Override public void truncate() throws IOException { try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) { tableUtil.truncateTable(ddlExecutor, tableId); } }
@Override public void drop() throws IOException { try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) { tableUtil.dropTable(ddlExecutor, tableId); } }
private void createQueueTable(TableDescriptorBuilder tdBuilder, byte[][] splitKeys) throws IOException { int prefixBytes = (type == QueueConstants.QueueType.SHARDED_QUEUE) ? ShardedHBaseQueueStrategy.PREFIX_BYTES : SaltedHBaseQueueStrategy.SALT_BYTES; String prefix = Integer.toString(prefixBytes); tdBuilder.addProperty(HBaseQueueAdmin.PROPERTY_PREFIX_BYTES, prefix); LOG.info("Create queue table with prefix bytes {}", prefix); try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) { ddlExecutor.createTableIfNotExists(tdBuilder.build(), splitKeys); } } }
public void disableMessageTable(String tableName) throws IOException { TableId tableId = tableUtil.createHTableId(NamespaceId.SYSTEM, tableName); try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) { disableTable(ddlExecutor, tableId); } }
public void disablePayloadTable(String tableName) throws IOException { TableId tableId = tableUtil.createHTableId(NamespaceId.SYSTEM, tableName); try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) { disableTable(ddlExecutor, tableId); } }
public void disableMessageTable(String tableName) throws IOException { TableId tableId = tableUtil.createHTableId(NamespaceId.SYSTEM, tableName); try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) { disableTable(ddlExecutor, tableId); } }
private void truncate(TableId tableId) throws IOException { try (HBaseAdmin admin = new HBaseAdmin(hConf)) { if (!tableUtil.tableExists(admin, tableId)) { return; } } try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) { tableUtil.truncateTable(ddlExecutor, tableId); } }
private void drop(TableId tableId) throws IOException { try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get(); HBaseAdmin admin = new HBaseAdmin(hConf)) { if (tableUtil.tableExists(admin, tableId)) { tableUtil.dropTable(ddlExecutor, tableId); } } }
/** * Creates HBase namespace for the cdap system namespace. */ private void createSystemHBaseNamespace() { HBaseTableUtil tableUtil = new HBaseTableUtilFactory(cConf).get(); try (HBaseDDLExecutor ddlExecutor = new HBaseDDLExecutorFactory(cConf, hConf).get()) { ddlExecutor.createNamespaceIfNotExists(tableUtil.getHBaseNamespace(NamespaceId.SYSTEM)); } catch (IOException e) { throw Throwables.propagate(e); } }
@Override public void create() throws IOException { ColumnFamilyDescriptorBuilder cfdBuilder = HBaseTableUtil.getColumnFamilyDescriptorBuilder(Bytes.toString(DATA_COLUMN_FAMILY), hConf); TableDescriptorBuilder tdBuilder = HBaseTableUtil.getTableDescriptorBuilder(tableId, cConf) .addColumnFamily(cfdBuilder.build()); try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) { ddlExecutor.createTableIfNotExists(tdBuilder.build(), null); } }
@Override public void create() throws IOException { ColumnFamilyDescriptorBuilder cfdBuilder = HBaseTableUtil.getColumnFamilyDescriptorBuilder(Bytes.toString(DATA_COLUMN_FAMILY), hConf); TableDescriptorBuilder tdBuilder = HBaseTableUtil.getTableDescriptorBuilder(tableId, cConf) .addColumnFamily(cfdBuilder.build()); try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) { ddlExecutor.createTableIfNotExists(tdBuilder.build(), null); } }
@Override protected void dropTable(TableId tableId) throws IOException { try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get(); HBaseAdmin admin = new HBaseAdmin(hConf)) { TableId hBaseTableId = tableUtil.createHTableId(new NamespaceId(tableId.getNamespace()), tableId.getTableName()); if (tableUtil.tableExists(admin, hBaseTableId)) { tableUtil.dropTable(ddlExecutor, hBaseTableId); } } }
@BeforeClass public static void beforeClass() throws Exception { hAdmin = new HBaseAdmin(TEST_HBASE.getConfiguration()); cConf = CConfiguration.create(); ddlExecutor = new HBaseDDLExecutorFactory(cConf, TEST_HBASE.getConfiguration()).get(); }