Search in sources :

Example 1 with InMemoryTxSystemClient

use of co.cask.tephra.inmemory.InMemoryTxSystemClient in project hive by apache.

the class TephraHBaseConnection method connect.

@Override
public void connect() throws IOException {
    super.connect();
    if (HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVE_IN_TEST)) {
        LOG.debug("Using an in memory client transaction system for testing");
        TransactionManager txnMgr = new TransactionManager(conf);
        txnMgr.startAndWait();
        txnClient = new InMemoryTxSystemClient(txnMgr);
    } else {
        // TODO should enable use of ZKDiscoveryService if users want it
        LOG.debug("Using real client transaction system for production");
        txnClient = new TransactionServiceClient(conf, new ThreadLocalClientProvider(conf, new InMemoryDiscoveryService()));
    }
    for (String tableName : HBaseReadWrite.tableNames) {
        txnTables.put(tableName, new TransactionAwareHTable(super.getHBaseTable(tableName, true)));
    }
    txn = new TransactionContext(txnClient, txnTables.values());
}
Also used : TransactionAwareHTable(co.cask.tephra.hbase10.TransactionAwareHTable) TransactionManager(co.cask.tephra.TransactionManager) TransactionContext(co.cask.tephra.TransactionContext) ThreadLocalClientProvider(co.cask.tephra.distributed.ThreadLocalClientProvider) InMemoryTxSystemClient(co.cask.tephra.inmemory.InMemoryTxSystemClient) InMemoryDiscoveryService(org.apache.twill.discovery.InMemoryDiscoveryService) TransactionServiceClient(co.cask.tephra.distributed.TransactionServiceClient)

Aggregations

TransactionContext (co.cask.tephra.TransactionContext)1 TransactionManager (co.cask.tephra.TransactionManager)1 ThreadLocalClientProvider (co.cask.tephra.distributed.ThreadLocalClientProvider)1 TransactionServiceClient (co.cask.tephra.distributed.TransactionServiceClient)1 TransactionAwareHTable (co.cask.tephra.hbase10.TransactionAwareHTable)1 InMemoryTxSystemClient (co.cask.tephra.inmemory.InMemoryTxSystemClient)1 InMemoryDiscoveryService (org.apache.twill.discovery.InMemoryDiscoveryService)1