use of co.cask.cdap.common.conf.CConfiguration in project cdap by caskdata.
the class AbstractSystemMetadataWriterTest method setup.
@BeforeClass
public static void setup() throws IOException {
CConfiguration cConf = CConfiguration.create();
Injector injector = Guice.createInjector(new ConfigModule(cConf), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getMasterModule(), Modules.override(new DataSetsModules().getInMemoryModules()).with(new AbstractModule() {
@Override
protected void configure() {
// Need the distributed metadata store.
bind(MetadataStore.class).to(DefaultMetadataStore.class);
}
}), new LocationRuntimeModule().getInMemoryModules(), new TransactionInMemoryModule(), new SystemDatasetRuntimeModule().getInMemoryModules(), new NamespaceClientRuntimeModule().getInMemoryModules());
txManager = injector.getInstance(TransactionManager.class);
txManager.startAndWait();
store = injector.getInstance(MetadataStore.class);
}
use of co.cask.cdap.common.conf.CConfiguration in project cdap by caskdata.
the class ContextManager method createContext.
// this method is called by the mappers/reducers of jobs launched by Hive.
private static Context createContext(Configuration conf) throws IOException {
// Create context needs to happen only when running in as a MapReduce job.
// In other cases, ContextManager will be initialized using saveContext method.
CConfiguration cConf = ConfigurationUtil.get(conf, Constants.Explore.CCONF_KEY, CConfCodec.INSTANCE);
Configuration hConf = ConfigurationUtil.get(conf, Constants.Explore.HCONF_KEY, HConfCodec.INSTANCE);
Injector injector = createInjector(cConf, hConf);
ZKClientService zkClientService = injector.getInstance(ZKClientService.class);
zkClientService.startAndWait();
DatasetFramework datasetFramework = injector.getInstance(DatasetFramework.class);
StreamAdmin streamAdmin = injector.getInstance(StreamAdmin.class);
SystemDatasetInstantiatorFactory datasetInstantiatorFactory = injector.getInstance(SystemDatasetInstantiatorFactory.class);
AuthenticationContext authenticationContext = injector.getInstance(AuthenticationContext.class);
AuthorizationEnforcer authorizationEnforcer = injector.getInstance(AuthorizationEnforcer.class);
return new Context(datasetFramework, streamAdmin, zkClientService, datasetInstantiatorFactory, authenticationContext, authorizationEnforcer);
}
use of co.cask.cdap.common.conf.CConfiguration in project cdap by caskdata.
the class MessageTableRegionObserver method initializePruneState.
private void initializePruneState(RegionCoprocessorEnvironment env) {
CConfiguration conf = topicMetadataCache.getCConfiguration();
if (conf != null) {
pruneEnable = conf.getBoolean(TxConstants.TransactionPruning.PRUNE_ENABLE, TxConstants.TransactionPruning.DEFAULT_PRUNE_ENABLE);
if (Boolean.TRUE.equals(pruneEnable)) {
String pruneTable = conf.get(TxConstants.TransactionPruning.PRUNE_STATE_TABLE, TxConstants.TransactionPruning.DEFAULT_PRUNE_STATE_TABLE);
long pruneFlushInterval = TimeUnit.SECONDS.toMillis(conf.getLong(TxConstants.TransactionPruning.PRUNE_FLUSH_INTERVAL, TxConstants.TransactionPruning.DEFAULT_PRUNE_FLUSH_INTERVAL));
compactionState = new CompactionState(env, TableName.valueOf(pruneTable), pruneFlushInterval);
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("Automatic invalid list pruning is enabled for table %s. Compaction state " + "will be recorded in table %s", env.getRegionInfo().getTable().getNameWithNamespaceInclAsString(), pruneTable));
}
}
}
}
use of co.cask.cdap.common.conf.CConfiguration in project cdap by caskdata.
the class HBaseQueueRegionObserver method reloadPruneState.
private void reloadPruneState(RegionCoprocessorEnvironment env) {
if (pruneEnable == null) {
// If prune enable has never been initialized, try to do so now
initializePruneState(env);
} else {
CConfiguration conf = configCache.getCConf();
if (conf != null) {
boolean newPruneEnable = conf.getBoolean(TxConstants.TransactionPruning.PRUNE_ENABLE, TxConstants.TransactionPruning.DEFAULT_PRUNE_ENABLE);
if (newPruneEnable != pruneEnable) {
// pruning enable has been changed, resetting prune state
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("Transaction Invalid List pruning feature is set to %s now for region %s.", newPruneEnable, env.getRegionInfo().getRegionNameAsString()));
}
resetPruneState();
initializePruneState(env);
}
}
}
}
use of co.cask.cdap.common.conf.CConfiguration in project cdap by caskdata.
the class HBaseQueueRegionObserver method initializePruneState.
private void initializePruneState(RegionCoprocessorEnvironment env) {
CConfiguration conf = configCache.getCConf();
if (conf != null) {
pruneEnable = conf.getBoolean(TxConstants.TransactionPruning.PRUNE_ENABLE, TxConstants.TransactionPruning.DEFAULT_PRUNE_ENABLE);
if (Boolean.TRUE.equals(pruneEnable)) {
String pruneTable = conf.get(TxConstants.TransactionPruning.PRUNE_STATE_TABLE, TxConstants.TransactionPruning.DEFAULT_PRUNE_STATE_TABLE);
long pruneFlushInterval = TimeUnit.SECONDS.toMillis(conf.getLong(TxConstants.TransactionPruning.PRUNE_FLUSH_INTERVAL, TxConstants.TransactionPruning.DEFAULT_PRUNE_FLUSH_INTERVAL));
compactionState = new CompactionState(env, TableName.valueOf(pruneTable), pruneFlushInterval);
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("Automatic invalid list pruning is enabled for table %s. Compaction state " + "will be recorded in table %s", env.getRegionInfo().getTable().getNameWithNamespaceInclAsString(), pruneTable));
}
}
}
}
Aggregations