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 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; } });
protected HBaseQueueAdmin(Configuration hConf, CConfiguration cConf, LocationFactory locationFactory, HBaseTableUtil tableUtil, DatasetFramework datasetFramework, TransactionExecutorFactory txExecutorFactory, QueueConstants.QueueType type, NamespaceQueryAdmin namespaceQueryAdmin, Impersonator impersonator) { super(type); this.hConf = hConf; this.cConf = cConf; this.tableUtil = tableUtil; this.txExecutorFactory = txExecutorFactory; this.datasetFramework = datasetFramework; this.type = type; this.namespaceQueryAdmin = namespaceQueryAdmin; this.impersonator = impersonator; this.locationFactory = locationFactory; this.ddlExecutorFactory = new HBaseDDLExecutorFactory(cConf, hConf); }
@Override public void truncate() throws IOException { try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) { tableUtil.truncateTable(ddlExecutor, tableId); } }
@Inject HBaseStreamConsumerStateStoreFactory(CConfiguration cConf, Configuration hConf, HBaseTableUtil tableUtil) { this.cConf = cConf; this.hConf = hConf; this.tableUtil = tableUtil; this.ddlExecutorFactory = new HBaseDDLExecutorFactory(cConf, hConf); }
@Override public void drop() throws IOException { try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) { 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); } }
@Inject HBaseStreamFileConsumerFactory(StreamAdmin streamAdmin, StreamConsumerStateStoreFactory stateStoreFactory, CConfiguration cConf, Configuration hConf, HBaseTableUtil tableUtil) { super(cConf, streamAdmin, stateStoreFactory); this.hConf = hConf; this.cConf = cConf; this.tableUtil = tableUtil; this.ddlExecutorFactory = new HBaseDDLExecutorFactory(cConf, hConf); }
@Override public void drop() throws IOException { try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) { tableUtil.dropTable(ddlExecutor, tableId); } }
/** * Creates the configuration HBase table if it does not exist. */ @VisibleForTesting void createTableIfNecessary() throws IOException { try (HBaseDDLExecutor ddlExecutor = new HBaseDDLExecutorFactory(cConf, hConf).get()) { HBaseTableUtil tableUtil = new HBaseTableUtilFactory(cConf).get(); TableId tableId = tableUtil.createHTableId(NamespaceId.SYSTEM, TABLE_NAME); ColumnFamilyDescriptorBuilder cfdBuilder = HBaseTableUtil.getColumnFamilyDescriptorBuilder(Bytes.toString(FAMILY), hConf); TableDescriptorBuilder tdBuilder = HBaseTableUtil.getTableDescriptorBuilder(tableId, cConf).addColumnFamily(cfdBuilder.build()); ddlExecutor.createTableIfNotExists(tdBuilder.build(), null); } } }
@Inject DistributedStorageProviderNamespaceAdmin(CConfiguration cConf, NamespacePathLocator namespacePathLocator, ExploreFacade exploreFacade, HBaseTableUtil tableUtil, NamespaceQueryAdmin namespaceQueryAdmin) { super(cConf, namespacePathLocator, exploreFacade, namespaceQueryAdmin); this.hConf = HBaseConfiguration.create(); this.tableUtil = tableUtil; this.namespaceQueryAdmin = namespaceQueryAdmin; this.hBaseDDLExecutorFactory = new HBaseDDLExecutorFactory(cConf, hConf); }
@Override public void truncate() throws IOException { try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) { tableUtil.truncateTable(ddlExecutor, tableId); } }
/** * Creates the configuration HBase table if it does not exist. */ @VisibleForTesting void createTableIfNecessary() throws IOException { try (HBaseDDLExecutor ddlExecutor = new HBaseDDLExecutorFactory(cConf, hConf).get()) { HBaseTableUtil tableUtil = new HBaseTableUtilFactory(cConf).get(); TableId tableId = tableUtil.createHTableId(NamespaceId.SYSTEM, TABLE_NAME); ColumnFamilyDescriptorBuilder cfdBuilder = HBaseTableUtil.getColumnFamilyDescriptorBuilder(Bytes.toString(FAMILY), hConf); TableDescriptorBuilder tdBuilder = HBaseTableUtil.getTableDescriptorBuilder(tableId, cConf).addColumnFamily(cfdBuilder.build()); ddlExecutor.createTableIfNotExists(tdBuilder.build(), null); } } }
@Inject DistributedStorageProviderNamespaceAdmin(CConfiguration cConf, NamespacedLocationFactory namespacedLocationFactory, ExploreFacade exploreFacade, HBaseTableUtil tableUtil, NamespaceQueryAdmin namespaceQueryAdmin) { super(cConf, namespacedLocationFactory, exploreFacade, namespaceQueryAdmin); this.hConf = HBaseConfiguration.create(); this.tableUtil = tableUtil; this.namespaceQueryAdmin = namespaceQueryAdmin; this.hBaseDDLExecutorFactory = new HBaseDDLExecutorFactory(cConf, hConf); }
@Override public void truncate() throws IOException { try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) { tableUtil.truncateTable(ddlExecutor, tableId); } }
@BeforeClass public static void beforeClass() throws Exception { hAdmin = new HBaseAdmin(TEST_HBASE.getConfiguration()); cConf = CConfiguration.create(); ddlExecutor = new HBaseDDLExecutorFactory(cConf, TEST_HBASE.getConfiguration()).get(); }
@Inject DatasetUpgrader(CConfiguration cConf, Configuration hConf, LocationFactory locationFactory, NamespacePathLocator namespacePathLocator, HBaseTableUtil hBaseTableUtil, DatasetFramework dsFramework, NamespaceQueryAdmin namespaceQueryAdmin, Impersonator impersonator) { super(locationFactory, namespacePathLocator); this.cConf = cConf; this.hConf = hConf; this.locationFactory = locationFactory; this.hBaseTableUtil = hBaseTableUtil; this.dsFramework = dsFramework; this.namespaceQueryAdmin = namespaceQueryAdmin; this.impersonator = impersonator; this.datasetTablePrefix = cConf.get(Constants.Dataset.TABLE_PREFIX); this.defaultNSUserTablePrefix = Pattern.compile(String.format("^%s\\.user\\..*", datasetTablePrefix)); this.ddlExecutorFactory = new HBaseDDLExecutorFactory(cConf, hConf); }
@Override public void drop() throws IOException { try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) { tableUtil.dropTable(ddlExecutor, tableId); } }
protected AbstractHBaseDataSetAdmin(TableId tableId, Configuration hConf, CConfiguration cConf, HBaseTableUtil tableUtil, LocationFactory locationFactory) { this.tableId = tableId; this.hConf = hConf; this.cConf = cConf; this.tableUtil = tableUtil; this.tablePrefix = cConf.get(Constants.Dataset.TABLE_PREFIX); this.ddlExecutorFactory = new HBaseDDLExecutorFactory(cConf, hConf); this.coprocessorManager = new CoprocessorManager(cConf, locationFactory, tableUtil); }
@Override public void drop() throws IOException { try (HBaseDDLExecutor ddlExecutor = ddlExecutorFactory.get()) { tableUtil.dropTable(ddlExecutor, tableId); } }