Search in sources :

Example 26 with OpenTxnRequest

use of org.apache.hadoop.hive.metastore.api.OpenTxnRequest in project hive by apache.

the class TestOpenTxn method testGap.

@Test
public void testGap() throws Exception {
    OpenTxnRequest openTxnRequest = new OpenTxnRequest(1, "me", "localhost");
    txnHandler.openTxns(openTxnRequest);
    long second = txnHandler.openTxns(openTxnRequest).getTxn_ids().get(0);
    deleteTransaction(second);
    txnHandler.openTxns(openTxnRequest);
    GetOpenTxnsResponse openTxns = txnHandler.getOpenTxns();
    Assert.assertEquals(3, openTxns.getOpen_txnsSize());
}
Also used : GetOpenTxnsResponse(org.apache.hadoop.hive.metastore.api.GetOpenTxnsResponse) OpenTxnRequest(org.apache.hadoop.hive.metastore.api.OpenTxnRequest) Test(org.junit.Test)

Example 27 with OpenTxnRequest

use of org.apache.hadoop.hive.metastore.api.OpenTxnRequest in project hive by apache.

the class HMSClient method openTxnsIntr.

private OpenTxnsResponse openTxnsIntr(String user, int numTxns, TxnType txnType) throws TException {
    String hostname;
    try {
        hostname = InetAddress.getLocalHost().getHostName();
    } catch (UnknownHostException e) {
        LOG.error("Unable to resolve my host name " + e.getMessage());
        throw new RuntimeException(e);
    }
    OpenTxnRequest rqst = new OpenTxnRequest(numTxns, user, hostname);
    if (txnType != null) {
        rqst.setTxn_type(txnType);
    }
    return client.open_txns(rqst);
}
Also used : UnknownHostException(java.net.UnknownHostException) OpenTxnRequest(org.apache.hadoop.hive.metastore.api.OpenTxnRequest)

Aggregations

OpenTxnRequest (org.apache.hadoop.hive.metastore.api.OpenTxnRequest)27 Test (org.junit.Test)20 GetOpenTxnsResponse (org.apache.hadoop.hive.metastore.api.GetOpenTxnsResponse)16 OpenTxnsResponse (org.apache.hadoop.hive.metastore.api.OpenTxnsResponse)14 CommitTxnRequest (org.apache.hadoop.hive.metastore.api.CommitTxnRequest)10 AbortTxnRequest (org.apache.hadoop.hive.metastore.api.AbortTxnRequest)7 ArrayList (java.util.ArrayList)6 GetOpenTxnsInfoResponse (org.apache.hadoop.hive.metastore.api.GetOpenTxnsInfoResponse)6 AllocateTableWriteIdsRequest (org.apache.hadoop.hive.metastore.api.AllocateTableWriteIdsRequest)5 AllocateTableWriteIdsResponse (org.apache.hadoop.hive.metastore.api.AllocateTableWriteIdsResponse)5 LockComponent (org.apache.hadoop.hive.metastore.api.LockComponent)4 LockRequest (org.apache.hadoop.hive.metastore.api.LockRequest)4 LockResponse (org.apache.hadoop.hive.metastore.api.LockResponse)4 AbortTxnsRequest (org.apache.hadoop.hive.metastore.api.AbortTxnsRequest)3 CompactionRequest (org.apache.hadoop.hive.metastore.api.CompactionRequest)3 MetaException (org.apache.hadoop.hive.metastore.api.MetaException)3 Connection (java.sql.Connection)2 SQLException (java.sql.SQLException)2 Statement (java.sql.Statement)2 List (java.util.List)2