Search in sources :

Example 1 with ValidTxnList

use of org.apache.hadoop.hive.common.ValidTxnList in project hive by apache.

the class TestValidCompactorTxnList method maxTxnLowNoExceptions.

@Test
public void maxTxnLowNoExceptions() {
    ValidTxnList txns = new ValidCompactorTxnList(new long[0], 15);
    ValidTxnList.RangeResponse rsp = txns.isTxnRangeValid(7, 9);
    Assert.assertEquals(ValidTxnList.RangeResponse.ALL, rsp);
}
Also used : ValidTxnList(org.apache.hadoop.hive.common.ValidTxnList) ValidCompactorTxnList(org.apache.hadoop.hive.common.ValidCompactorTxnList) Test(org.junit.Test)

Example 2 with ValidTxnList

use of org.apache.hadoop.hive.common.ValidTxnList in project hive by apache.

the class TestValidCompactorTxnList method minTxnHighNoExceptions.

@Test
public void minTxnHighNoExceptions() {
    ValidTxnList txns = new ValidCompactorTxnList(new long[0], 5);
    ValidTxnList.RangeResponse rsp = txns.isTxnRangeValid(7, 9);
    Assert.assertEquals(ValidTxnList.RangeResponse.NONE, rsp);
}
Also used : ValidTxnList(org.apache.hadoop.hive.common.ValidTxnList) ValidCompactorTxnList(org.apache.hadoop.hive.common.ValidCompactorTxnList) Test(org.junit.Test)

Example 3 with ValidTxnList

use of org.apache.hadoop.hive.common.ValidTxnList in project hive by apache.

the class TestValidCompactorTxnList method exceptionsAllBelow.

@Test
public void exceptionsAllBelow() {
    ValidTxnList txns = new ValidCompactorTxnList(new long[] { 3, 6 }, 3);
    ValidTxnList.RangeResponse rsp = txns.isTxnRangeValid(7, 9);
    Assert.assertEquals(ValidTxnList.RangeResponse.NONE, rsp);
}
Also used : ValidTxnList(org.apache.hadoop.hive.common.ValidTxnList) ValidCompactorTxnList(org.apache.hadoop.hive.common.ValidCompactorTxnList) Test(org.junit.Test)

Example 4 with ValidTxnList

use of org.apache.hadoop.hive.common.ValidTxnList in project hive by apache.

the class TestHiveMetaStoreTxns method testTxns.

@Test
public void testTxns() throws Exception {
    List<Long> tids = client.openTxns("me", 3).getTxn_ids();
    Assert.assertEquals(1L, (long) tids.get(0));
    Assert.assertEquals(2L, (long) tids.get(1));
    Assert.assertEquals(3L, (long) tids.get(2));
    client.rollbackTxn(1);
    client.commitTxn(2);
    ValidTxnList validTxns = client.getValidTxns();
    Assert.assertFalse(validTxns.isTxnValid(1));
    Assert.assertTrue(validTxns.isTxnValid(2));
    Assert.assertFalse(validTxns.isTxnValid(3));
    Assert.assertFalse(validTxns.isTxnValid(4));
}
Also used : ValidTxnList(org.apache.hadoop.hive.common.ValidTxnList) Test(org.junit.Test)

Example 5 with ValidTxnList

use of org.apache.hadoop.hive.common.ValidTxnList in project hive by apache.

the class TestHiveMetaStoreTxns method testOpenTxnNotExcluded.

@Test
public void testOpenTxnNotExcluded() throws Exception {
    List<Long> tids = client.openTxns("me", 3).getTxn_ids();
    Assert.assertEquals(1L, (long) tids.get(0));
    Assert.assertEquals(2L, (long) tids.get(1));
    Assert.assertEquals(3L, (long) tids.get(2));
    client.rollbackTxn(1);
    client.commitTxn(2);
    ValidTxnList validTxns = client.getValidTxns(3);
    Assert.assertFalse(validTxns.isTxnValid(1));
    Assert.assertTrue(validTxns.isTxnValid(2));
    Assert.assertTrue(validTxns.isTxnValid(3));
    Assert.assertFalse(validTxns.isTxnValid(4));
}
Also used : ValidTxnList(org.apache.hadoop.hive.common.ValidTxnList) Test(org.junit.Test)

Aggregations

ValidTxnList (org.apache.hadoop.hive.common.ValidTxnList)22 Test (org.junit.Test)13 ValidCompactorTxnList (org.apache.hadoop.hive.common.ValidCompactorTxnList)8 ValidReadTxnList (org.apache.hadoop.hive.common.ValidReadTxnList)6 AcidUtils (org.apache.hadoop.hive.ql.io.AcidUtils)5 Configuration (org.apache.hadoop.conf.Configuration)4 RecordIdentifier (org.apache.hadoop.hive.ql.io.RecordIdentifier)4 Path (org.apache.hadoop.fs.Path)3 Partition (org.apache.hadoop.hive.metastore.api.Partition)3 StorageDescriptor (org.apache.hadoop.hive.metastore.api.StorageDescriptor)3 Table (org.apache.hadoop.hive.metastore.api.Table)3 IOException (java.io.IOException)2 FileSystem (org.apache.hadoop.fs.FileSystem)2 MetaException (org.apache.hadoop.hive.metastore.api.MetaException)2 CompactionInfo (org.apache.hadoop.hive.metastore.txn.CompactionInfo)2 AcidOutputFormat (org.apache.hadoop.hive.ql.io.AcidOutputFormat)2 OrcInputFormat (org.apache.hadoop.hive.ql.io.orc.OrcInputFormat)2 OrcStruct (org.apache.hadoop.hive.ql.io.orc.OrcStruct)2 ObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector)2 StructObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector)2