Search in sources :

Example 46 with CommitTxnRequest

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

the class TestAcidTxnCleanerService method cleansCommittedAndEmptyAbortedOnly.

@Test
public void cleansCommittedAndEmptyAbortedOnly() throws Exception {
    for (int i = 0; i < 5; ++i) {
        // commit one
        long txnid = openTxn();
        txnHandler.commitTxn(new CommitTxnRequest(txnid));
        // abort one empty
        txnid = openTxn();
        txnHandler.abortTxn(new AbortTxnRequest(txnid));
        // abort one non-empty
        openNonEmptyThenAbort();
    }
    Assert.assertEquals(15 + 1, getTxnCount());
    Thread.sleep(txnHandler.getOpenTxnTimeOutMillis() * 2);
    underTest.run();
    // kept only the 5 non-empty aborted ones
    Assert.assertEquals(5, getTxnCount());
    Assert.assertTrue("The max txnId should be at least 15", getMaxTxnId() >= 15);
}
Also used : CommitTxnRequest(org.apache.hadoop.hive.metastore.api.CommitTxnRequest) AbortTxnRequest(org.apache.hadoop.hive.metastore.api.AbortTxnRequest) Test(org.junit.Test)

Aggregations

CommitTxnRequest (org.apache.hadoop.hive.metastore.api.CommitTxnRequest)46 Test (org.junit.Test)41 ArrayList (java.util.ArrayList)27 LockComponent (org.apache.hadoop.hive.metastore.api.LockComponent)27 LockRequest (org.apache.hadoop.hive.metastore.api.LockRequest)27 LockResponse (org.apache.hadoop.hive.metastore.api.LockResponse)27 Table (org.apache.hadoop.hive.metastore.api.Table)26 ShowCompactRequest (org.apache.hadoop.hive.metastore.api.ShowCompactRequest)22 ShowCompactResponse (org.apache.hadoop.hive.metastore.api.ShowCompactResponse)22 Partition (org.apache.hadoop.hive.metastore.api.Partition)16 ShowCompactResponseElement (org.apache.hadoop.hive.metastore.api.ShowCompactResponseElement)16 OpenTxnRequest (org.apache.hadoop.hive.metastore.api.OpenTxnRequest)10 GetOpenTxnsResponse (org.apache.hadoop.hive.metastore.api.GetOpenTxnsResponse)7 OpenTxnsResponse (org.apache.hadoop.hive.metastore.api.OpenTxnsResponse)6 AbortTxnRequest (org.apache.hadoop.hive.metastore.api.AbortTxnRequest)5 ValidTxnList (org.apache.hadoop.hive.common.ValidTxnList)4 AllocateTableWriteIdsRequest (org.apache.hadoop.hive.metastore.api.AllocateTableWriteIdsRequest)4 AllocateTableWriteIdsResponse (org.apache.hadoop.hive.metastore.api.AllocateTableWriteIdsResponse)4 CompactionRequest (org.apache.hadoop.hive.metastore.api.CompactionRequest)3 GetOpenTxnsInfoResponse (org.apache.hadoop.hive.metastore.api.GetOpenTxnsInfoResponse)3