Search in sources :

Example 26 with TransactionManager

use of org.apache.tephra.TransactionManager in project phoenix by apache.

the class TephraTransactionContext method setupTxManager.

@Override
public void setupTxManager(Configuration config, String url) throws SQLException {
    if (txService != null) {
        return;
    }
    ConnectionInfo connInfo = ConnectionInfo.create(url);
    zkClient = ZKClientServices.delegate(ZKClients.reWatchOnExpire(ZKClients.retryOnFailure(ZKClientService.Builder.of(connInfo.getZookeeperConnectionString()).setSessionTimeout(config.getInt(HConstants.ZK_SESSION_TIMEOUT, HConstants.DEFAULT_ZK_SESSION_TIMEOUT)).build(), RetryStrategies.exponentialDelay(500, 2000, TimeUnit.MILLISECONDS))));
    zkClient.startAndWait();
    DiscoveryService discovery = new ZKDiscoveryService(zkClient);
    txManager = new TransactionManager(config, new HDFSTransactionStateStorage(config, new SnapshotCodecProvider(config), new TxMetricsCollector()), new TxMetricsCollector());
    txService = new TransactionService(config, zkClient, discovery, Providers.of(txManager));
    txService.startAndWait();
}
Also used : ZKDiscoveryService(org.apache.twill.discovery.ZKDiscoveryService) HDFSTransactionStateStorage(org.apache.tephra.persist.HDFSTransactionStateStorage) TransactionService(org.apache.tephra.distributed.TransactionService) TransactionManager(org.apache.tephra.TransactionManager) TxMetricsCollector(org.apache.tephra.metrics.TxMetricsCollector) ConnectionInfo(org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.ConnectionInfo) ZKDiscoveryService(org.apache.twill.discovery.ZKDiscoveryService) DiscoveryService(org.apache.twill.discovery.DiscoveryService) SnapshotCodecProvider(org.apache.tephra.snapshot.SnapshotCodecProvider)

Aggregations

TransactionManager (org.apache.tephra.TransactionManager)26 Configuration (org.apache.hadoop.conf.Configuration)15 Injector (com.google.inject.Injector)14 ConfigModule (co.cask.cdap.common.guice.ConfigModule)13 BeforeClass (org.junit.BeforeClass)13 AbstractModule (com.google.inject.AbstractModule)12 CConfiguration (co.cask.cdap.common.conf.CConfiguration)11 AuthorizationEnforcementModule (co.cask.cdap.security.authorization.AuthorizationEnforcementModule)11 AuthorizationTestModule (co.cask.cdap.security.authorization.AuthorizationTestModule)11 DiscoveryRuntimeModule (co.cask.cdap.common.guice.DiscoveryRuntimeModule)10 AuthenticationContextModules (co.cask.cdap.security.auth.context.AuthenticationContextModules)10 DataSetsModules (co.cask.cdap.data.runtime.DataSetsModules)9 DatasetService (co.cask.cdap.data2.datafabric.dataset.service.DatasetService)9 NamespaceClientRuntimeModule (co.cask.cdap.common.namespace.guice.NamespaceClientRuntimeModule)8 InMemoryTxSystemClient (org.apache.tephra.inmemory.InMemoryTxSystemClient)8 NonCustomLocationUnitTestModule (co.cask.cdap.common.guice.NonCustomLocationUnitTestModule)7 DataFabricModules (co.cask.cdap.data.runtime.DataFabricModules)6 ExploreClientModule (co.cask.cdap.explore.guice.ExploreClientModule)6 LocationRuntimeModule (co.cask.cdap.common.guice.LocationRuntimeModule)5 DataSetServiceModules (co.cask.cdap.data.runtime.DataSetServiceModules)5