Search in sources :

Example 16 with AbortTxnRequest

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

the class TestInitiator method noCompactWhenNoCompactSetLowerCase.

@Test
public void noCompactWhenNoCompactSetLowerCase() throws Exception {
    Map<String, String> parameters = new HashMap<String, String>(1);
    parameters.put("no_auto_compaction", "true");
    Table t = newTable("default", "ncwncs", false, parameters);
    HiveConf.setIntVar(conf, HiveConf.ConfVars.HIVE_COMPACTOR_ABORTEDTXN_THRESHOLD, 10);
    for (int i = 0; i < 11; i++) {
        long txnid = openTxn();
        LockComponent comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.TABLE, "default");
        comp.setOperationType(DataOperationType.DELETE);
        comp.setTablename("ncwncs");
        List<LockComponent> components = new ArrayList<LockComponent>(1);
        components.add(comp);
        LockRequest req = new LockRequest(components, "me", "localhost");
        req.setTxnid(txnid);
        LockResponse res = txnHandler.lock(req);
        txnHandler.abortTxn(new AbortTxnRequest(txnid));
    }
    startInitiator();
    ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest());
    Assert.assertEquals(0, rsp.getCompactsSize());
}
Also used : Table(org.apache.hadoop.hive.metastore.api.Table) LockComponent(org.apache.hadoop.hive.metastore.api.LockComponent) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) AbortTxnRequest(org.apache.hadoop.hive.metastore.api.AbortTxnRequest) LockResponse(org.apache.hadoop.hive.metastore.api.LockResponse) ShowCompactResponse(org.apache.hadoop.hive.metastore.api.ShowCompactResponse) ShowCompactRequest(org.apache.hadoop.hive.metastore.api.ShowCompactRequest) LockRequest(org.apache.hadoop.hive.metastore.api.LockRequest) Test(org.junit.Test)

Aggregations

AbortTxnRequest (org.apache.hadoop.hive.metastore.api.AbortTxnRequest)16 Test (org.junit.Test)16 ArrayList (java.util.ArrayList)12 LockComponent (org.apache.hadoop.hive.metastore.api.LockComponent)11 LockRequest (org.apache.hadoop.hive.metastore.api.LockRequest)11 LockResponse (org.apache.hadoop.hive.metastore.api.LockResponse)11 Table (org.apache.hadoop.hive.metastore.api.Table)7 ShowCompactRequest (org.apache.hadoop.hive.metastore.api.ShowCompactRequest)6 ShowCompactResponse (org.apache.hadoop.hive.metastore.api.ShowCompactResponse)6 GetOpenTxnsResponse (org.apache.hadoop.hive.metastore.api.GetOpenTxnsResponse)4 CheckLockRequest (org.apache.hadoop.hive.metastore.api.CheckLockRequest)3 OpenTxnRequest (org.apache.hadoop.hive.metastore.api.OpenTxnRequest)3 ShowCompactResponseElement (org.apache.hadoop.hive.metastore.api.ShowCompactResponseElement)3 HashMap (java.util.HashMap)2 CommitTxnRequest (org.apache.hadoop.hive.metastore.api.CommitTxnRequest)2 CompactionRequest (org.apache.hadoop.hive.metastore.api.CompactionRequest)2 GetOpenTxnsInfoResponse (org.apache.hadoop.hive.metastore.api.GetOpenTxnsInfoResponse)2 NoSuchTxnException (org.apache.hadoop.hive.metastore.api.NoSuchTxnException)2 Partition (org.apache.hadoop.hive.metastore.api.Partition)2 AddDynamicPartitions (org.apache.hadoop.hive.metastore.api.AddDynamicPartitions)1