Search in sources :

Example 6 with AllocateTableWriteIdsResponse

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

the class CompactorTest method allocateWriteId.

protected long allocateWriteId(String dbName, String tblName, long txnid) throws MetaException, TxnAbortedException, NoSuchTxnException {
    AllocateTableWriteIdsRequest awiRqst = new AllocateTableWriteIdsRequest(Collections.singletonList(txnid), dbName, tblName);
    AllocateTableWriteIdsResponse awiResp = txnHandler.allocateTableWriteIds(awiRqst);
    return awiResp.getTxnToWriteIds().get(0).getWriteId();
}
Also used : AllocateTableWriteIdsResponse(org.apache.hadoop.hive.metastore.api.AllocateTableWriteIdsResponse) AllocateTableWriteIdsRequest(org.apache.hadoop.hive.metastore.api.AllocateTableWriteIdsRequest)

Example 7 with AllocateTableWriteIdsResponse

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

the class CompactorTest method burnThroughTransactions.

protected void burnThroughTransactions(String dbName, String tblName, int num, Set<Long> open, Set<Long> aborted) throws MetaException, NoSuchTxnException, TxnAbortedException {
    OpenTxnsResponse rsp = txnHandler.openTxns(new OpenTxnRequest(num, "me", "localhost"));
    AllocateTableWriteIdsRequest awiRqst = new AllocateTableWriteIdsRequest(rsp.getTxn_ids(), dbName, tblName);
    AllocateTableWriteIdsResponse awiResp = txnHandler.allocateTableWriteIds(awiRqst);
    int i = 0;
    for (long tid : rsp.getTxn_ids()) {
        assert (awiResp.getTxnToWriteIds().get(i++).getTxnId() == tid);
        if (aborted != null && aborted.contains(tid)) {
            txnHandler.abortTxn(new AbortTxnRequest(tid));
        } else if (open == null || (open != null && !open.contains(tid))) {
            txnHandler.commitTxn(new CommitTxnRequest(tid));
        }
    }
}
Also used : CommitTxnRequest(org.apache.hadoop.hive.metastore.api.CommitTxnRequest) AllocateTableWriteIdsResponse(org.apache.hadoop.hive.metastore.api.AllocateTableWriteIdsResponse) AllocateTableWriteIdsRequest(org.apache.hadoop.hive.metastore.api.AllocateTableWriteIdsRequest) OpenTxnRequest(org.apache.hadoop.hive.metastore.api.OpenTxnRequest) AbortTxnRequest(org.apache.hadoop.hive.metastore.api.AbortTxnRequest) OpenTxnsResponse(org.apache.hadoop.hive.metastore.api.OpenTxnsResponse)

Aggregations

AllocateTableWriteIdsResponse (org.apache.hadoop.hive.metastore.api.AllocateTableWriteIdsResponse)7 AllocateTableWriteIdsRequest (org.apache.hadoop.hive.metastore.api.AllocateTableWriteIdsRequest)6 AddDynamicPartitions (org.apache.hadoop.hive.metastore.api.AddDynamicPartitions)4 Test (org.junit.Test)4 CommitTxnRequest (org.apache.hadoop.hive.metastore.api.CommitTxnRequest)3 OpenTxnRequest (org.apache.hadoop.hive.metastore.api.OpenTxnRequest)3 OpenTxnsResponse (org.apache.hadoop.hive.metastore.api.OpenTxnsResponse)3 ArrayList (java.util.ArrayList)2 AbortTxnRequest (org.apache.hadoop.hive.metastore.api.AbortTxnRequest)2 GetOpenTxnsResponse (org.apache.hadoop.hive.metastore.api.GetOpenTxnsResponse)2 ShowLocksResponseElement (org.apache.hadoop.hive.metastore.api.ShowLocksResponseElement)2 CommandProcessorResponse (org.apache.hadoop.hive.ql.processors.CommandProcessorResponse)2 Connection (java.sql.Connection)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 Statement (java.sql.Statement)1 TreeSet (java.util.TreeSet)1 DataOperationType (org.apache.hadoop.hive.metastore.api.DataOperationType)1 GetOpenTxnsInfoResponse (org.apache.hadoop.hive.metastore.api.GetOpenTxnsInfoResponse)1 LockComponent (org.apache.hadoop.hive.metastore.api.LockComponent)1