Search in sources :

Example 16 with HBaseDDLExecutorFactory

use of io.cdap.cdap.data2.util.hbase.HBaseDDLExecutorFactory in project cdap by caskdata.

the class MetricHBaseTableUtilTest method beforeClass.

@BeforeClass
public static void beforeClass() throws Exception {
    cConf = CConfiguration.create();
    hBaseTableUtil = new HBaseTableUtilFactory(cConf, new SimpleNamespaceQueryAdmin()).get();
    HBaseDDLExecutor executor = new HBaseDDLExecutorFactory(cConf, TEST_HBASE.getHBaseAdmin().getConfiguration()).get();
    executor.createNamespaceIfNotExists(hBaseTableUtil.getHBaseNamespace(NamespaceId.SYSTEM));
}
Also used : HBaseDDLExecutor(io.cdap.cdap.spi.hbase.HBaseDDLExecutor) SimpleNamespaceQueryAdmin(io.cdap.cdap.common.namespace.SimpleNamespaceQueryAdmin) HBaseDDLExecutorFactory(io.cdap.cdap.data2.util.hbase.HBaseDDLExecutorFactory) HBaseTableUtilFactory(io.cdap.cdap.data2.util.hbase.HBaseTableUtilFactory) BeforeClass(org.junit.BeforeClass)

Example 17 with HBaseDDLExecutorFactory

use of io.cdap.cdap.data2.util.hbase.HBaseDDLExecutorFactory in project cdap by caskdata.

the class HBaseTableTest method beforeClass.

@BeforeClass
public static void beforeClass() throws Exception {
    cConf = CConfiguration.create();
    hBaseTableUtil = new HBaseTableUtilFactory(cConf, new SimpleNamespaceQueryAdmin()).get();
    // TODO: CDAP-1634 - Explore a way to not have every HBase test class do this.
    ddlExecutor = new HBaseDDLExecutorFactory(cConf, TEST_HBASE.getConfiguration()).get();
    ddlExecutor.createNamespaceIfNotExists(hBaseTableUtil.getHBaseNamespace(NAMESPACE1));
    ddlExecutor.createNamespaceIfNotExists(hBaseTableUtil.getHBaseNamespace(NAMESPACE2));
}
Also used : SimpleNamespaceQueryAdmin(io.cdap.cdap.common.namespace.SimpleNamespaceQueryAdmin) HBaseDDLExecutorFactory(io.cdap.cdap.data2.util.hbase.HBaseDDLExecutorFactory) HBaseTableUtilFactory(io.cdap.cdap.data2.util.hbase.HBaseTableUtilFactory) BeforeClass(org.junit.BeforeClass)

Example 18 with HBaseDDLExecutorFactory

use of io.cdap.cdap.data2.util.hbase.HBaseDDLExecutorFactory in project cdap by caskdata.

the class HBaseMessageTableTestRun method setupBeforeClass.

@BeforeClass
public static void setupBeforeClass() throws Exception {
    hConf = HBASE_TEST_BASE.getConfiguration();
    hConf.set(HBaseTableUtil.CFG_HBASE_TABLE_COMPRESSION, HBaseTableUtil.CompressionType.NONE.name());
    cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().getAbsolutePath());
    cConf.set(Constants.CFG_HDFS_NAMESPACE, cConf.get(Constants.CFG_LOCAL_DATA_DIR));
    cConf.set(Constants.CFG_HDFS_USER, System.getProperty("user.name"));
    tableUtil = new HBaseTableUtilFactory(cConf).get();
    ddlExecutor = new HBaseDDLExecutorFactory(cConf, hConf).get();
    ddlExecutor.createNamespaceIfNotExists(tableUtil.getHBaseNamespace(NamespaceId.SYSTEM));
    LocationFactory locationFactory = getInjector().getInstance(LocationFactory.class);
    tableFactory = new HBaseTableFactory(cConf, hConf, tableUtil, locationFactory);
    new ConfigurationWriter(hConf, cConf).write(ConfigurationReader.Type.DEFAULT, cConf);
}
Also used : ConfigurationWriter(io.cdap.cdap.data2.util.hbase.ConfigurationWriter) HBaseDDLExecutorFactory(io.cdap.cdap.data2.util.hbase.HBaseDDLExecutorFactory) HBaseTableUtilFactory(io.cdap.cdap.data2.util.hbase.HBaseTableUtilFactory) LocationFactory(org.apache.twill.filesystem.LocationFactory) BeforeClass(org.junit.BeforeClass)

Example 19 with HBaseDDLExecutorFactory

use of io.cdap.cdap.data2.util.hbase.HBaseDDLExecutorFactory in project cdap by caskdata.

the class HBaseMetadataTableTestRun method setupBeforeClass.

@BeforeClass
public static void setupBeforeClass() throws Exception {
    hConf = HBASE_TEST_BASE.getConfiguration();
    hConf.set(HBaseTableUtil.CFG_HBASE_TABLE_COMPRESSION, HBaseTableUtil.CompressionType.NONE.name());
    tableUtil = new HBaseTableUtilFactory(cConf).get();
    ddlExecutor = new HBaseDDLExecutorFactory(cConf, hConf).get();
    ddlExecutor.createNamespaceIfNotExists(tableUtil.getHBaseNamespace(NamespaceId.SYSTEM));
    LocationFactory locationFactory = getInjector().getInstance(LocationFactory.class);
    tableFactory = new HBaseTableFactory(cConf, hConf, tableUtil, locationFactory);
}
Also used : HBaseDDLExecutorFactory(io.cdap.cdap.data2.util.hbase.HBaseDDLExecutorFactory) HBaseTableUtilFactory(io.cdap.cdap.data2.util.hbase.HBaseTableUtilFactory) LocationFactory(org.apache.twill.filesystem.LocationFactory) BeforeClass(org.junit.BeforeClass)

Example 20 with HBaseDDLExecutorFactory

use of io.cdap.cdap.data2.util.hbase.HBaseDDLExecutorFactory in project cdap by caskdata.

the class HBaseTableCoprocessorTestRun method setupBeforeClass.

@BeforeClass
public static void setupBeforeClass() throws Exception {
    hConf = HBASE_TEST_BASE.getConfiguration();
    hConf.set(HBaseTableUtil.CFG_HBASE_TABLE_COMPRESSION, HBaseTableUtil.CompressionType.NONE.name());
    cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().getAbsolutePath());
    cConf.set(Constants.CFG_HDFS_NAMESPACE, cConf.get(Constants.CFG_LOCAL_DATA_DIR));
    cConf.set(Constants.CFG_HDFS_USER, System.getProperty("user.name"));
    // Reduce the metadata cache refresh frequency for unit tests
    cConf.set(Constants.MessagingSystem.COPROCESSOR_METADATA_CACHE_UPDATE_FREQUENCY_SECONDS, Integer.toString(METADATA_CACHE_EXPIRY));
    hBaseAdmin = HBASE_TEST_BASE.getHBaseAdmin();
    hBaseAdmin.getConfiguration().set(HBaseTableUtil.CFG_HBASE_TABLE_COMPRESSION, HBaseTableUtil.CompressionType.NONE.name());
    tableUtil = new HBaseTableUtilFactory(cConf).get();
    ddlExecutor = new HBaseDDLExecutorFactory(cConf, hConf).get();
    ddlExecutor.createNamespaceIfNotExists(tableUtil.getHBaseNamespace(NamespaceId.SYSTEM));
    LocationFactory locationFactory = getInjector().getInstance(LocationFactory.class);
    tableFactory = new HBaseTableFactory(cConf, hBaseAdmin.getConfiguration(), tableUtil, locationFactory);
    new ConfigurationWriter(hConf, cConf).write(ConfigurationReader.Type.DEFAULT, cConf);
    // write an initial transaction snapshot
    invalidList.addAll(ImmutableList.of(V[3], V[5], V[7]));
    TransactionSnapshot txSnapshot = TransactionSnapshot.copyFrom(System.currentTimeMillis(), V[6] - 1, V[7], invalidList, // this will set visibility upper bound to V[6]
    Maps.newTreeMap(ImmutableSortedMap.of(V[6], new TransactionManager.InProgressTx(V[6] - 1, Long.MAX_VALUE, TransactionManager.InProgressType.SHORT))), new HashMap<>(), new TreeMap<>());
    HDFSTransactionStateStorage tmpStorage = new HDFSTransactionStateStorage(hConf, new SnapshotCodecProvider(hConf), new TxMetricsCollector());
    tmpStorage.startAndWait();
    tmpStorage.writeSnapshot(txSnapshot);
    tmpStorage.stopAndWait();
}
Also used : ConfigurationWriter(io.cdap.cdap.data2.util.hbase.ConfigurationWriter) TxMetricsCollector(org.apache.tephra.metrics.TxMetricsCollector) SnapshotCodecProvider(org.apache.tephra.snapshot.SnapshotCodecProvider) LocationFactory(org.apache.twill.filesystem.LocationFactory) HDFSTransactionStateStorage(org.apache.tephra.persist.HDFSTransactionStateStorage) TransactionSnapshot(org.apache.tephra.persist.TransactionSnapshot) TransactionManager(org.apache.tephra.TransactionManager) HBaseDDLExecutorFactory(io.cdap.cdap.data2.util.hbase.HBaseDDLExecutorFactory) HBaseTableUtilFactory(io.cdap.cdap.data2.util.hbase.HBaseTableUtilFactory) BeforeClass(org.junit.BeforeClass)

Aggregations

BeforeClass (org.junit.BeforeClass)24 HBaseDDLExecutorFactory (io.cdap.cdap.data2.util.hbase.HBaseDDLExecutorFactory)14 HBaseTableUtilFactory (io.cdap.cdap.data2.util.hbase.HBaseTableUtilFactory)12 LocationFactory (org.apache.twill.filesystem.LocationFactory)12 HBaseDDLExecutorFactory (co.cask.cdap.data2.util.hbase.HBaseDDLExecutorFactory)10 HBaseTableUtilFactory (co.cask.cdap.data2.util.hbase.HBaseTableUtilFactory)6 AbstractModule (com.google.inject.AbstractModule)6 ConfigurationWriter (io.cdap.cdap.data2.util.hbase.ConfigurationWriter)6 Injector (com.google.inject.Injector)5 ConfigModule (co.cask.cdap.common.guice.ConfigModule)4 DiscoveryRuntimeModule (co.cask.cdap.common.guice.DiscoveryRuntimeModule)4 ZKClientModule (co.cask.cdap.common.guice.ZKClientModule)4 SimpleNamespaceQueryAdmin (co.cask.cdap.common.namespace.SimpleNamespaceQueryAdmin)4 DataFabricModules (co.cask.cdap.data.runtime.DataFabricModules)4 DataSetsModules (co.cask.cdap.data.runtime.DataSetsModules)4 SystemDatasetRuntimeModule (co.cask.cdap.data.runtime.SystemDatasetRuntimeModule)4 TransactionMetricsModule (co.cask.cdap.data.runtime.TransactionMetricsModule)4 ConfigurationWriter (co.cask.cdap.data2.util.hbase.ConfigurationWriter)4 HBaseTableUtil (co.cask.cdap.data2.util.hbase.HBaseTableUtil)4 AuthenticationContextModules (co.cask.cdap.security.auth.context.AuthenticationContextModules)4