Search in sources :

Example 6 with ValidCompactorTxnList

use of org.apache.hadoop.hive.common.ValidCompactorTxnList 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 7 with ValidCompactorTxnList

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

the class TestValidCompactorTxnList method readFromString.

@Test
public void readFromString() {
    ValidCompactorTxnList txns = new ValidCompactorTxnList("37:" + Long.MAX_VALUE + ":7:9:10");
    Assert.assertEquals(37L, txns.getHighWatermark());
    Assert.assertEquals(Long.MAX_VALUE, txns.getMinOpenTxn());
    Assert.assertArrayEquals(new long[] { 7L, 9L, 10L }, txns.getInvalidTransactions());
    txns = new ValidCompactorTxnList("21:" + Long.MAX_VALUE + ":");
    Assert.assertEquals(21L, txns.getHighWatermark());
    Assert.assertEquals(Long.MAX_VALUE, txns.getMinOpenTxn());
    Assert.assertEquals(0, txns.getInvalidTransactions().length);
}
Also used : ValidCompactorTxnList(org.apache.hadoop.hive.common.ValidCompactorTxnList) Test(org.junit.Test)

Example 8 with ValidCompactorTxnList

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

the class TestAcidUtils method deltasWithOpenTxnsNotInCompact2.

@Test
public void deltasWithOpenTxnsNotInCompact2() throws Exception {
    Configuration conf = new Configuration();
    MockFileSystem fs = new MockFileSystem(conf, new MockFile("mock:/tbl/part1/delta_1_1/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/delta_2_5/bucket_0", 500, new byte[0]), new MockFile("mock:/tbl/part1/delta_2_5/bucket_0" + AcidUtils.DELTA_SIDE_FILE_SUFFIX, 500, new byte[0]), new MockFile("mock:/tbl/part1/delta_6_10/bucket_0", 500, new byte[0]));
    Path part = new MockPath(fs, "mock:/tbl/part1");
    AcidUtils.Directory dir = AcidUtils.getAcidState(part, conf, new ValidCompactorTxnList("3:" + Long.MAX_VALUE));
    List<AcidUtils.ParsedDelta> delts = dir.getCurrentDirectories();
    assertEquals(1, delts.size());
    assertEquals("mock:/tbl/part1/delta_1_1", delts.get(0).getPath().toString());
}
Also used : Path(org.apache.hadoop.fs.Path) MockPath(org.apache.hadoop.hive.ql.io.orc.TestInputOutputFormat.MockPath) Configuration(org.apache.hadoop.conf.Configuration) MockFile(org.apache.hadoop.hive.ql.io.orc.TestInputOutputFormat.MockFile) MockPath(org.apache.hadoop.hive.ql.io.orc.TestInputOutputFormat.MockPath) ValidCompactorTxnList(org.apache.hadoop.hive.common.ValidCompactorTxnList) MockFileSystem(org.apache.hadoop.hive.ql.io.orc.TestInputOutputFormat.MockFileSystem) Test(org.junit.Test)

Example 9 with ValidCompactorTxnList

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

the class TestValidCompactorTxnList method maxTxnLow.

@Test
public void maxTxnLow() {
    ValidTxnList txns = new ValidCompactorTxnList(new long[] { 13, 14 }, 12);
    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 10 with ValidCompactorTxnList

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

the class TestValidCompactorTxnList method minTxnHigh.

@Test
public void minTxnHigh() {
    ValidTxnList txns = new ValidCompactorTxnList(new long[] { 3, 4 }, 2);
    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)

Aggregations

ValidCompactorTxnList (org.apache.hadoop.hive.common.ValidCompactorTxnList)13 Test (org.junit.Test)12 ValidTxnList (org.apache.hadoop.hive.common.ValidTxnList)8 Configuration (org.apache.hadoop.conf.Configuration)3 Path (org.apache.hadoop.fs.Path)3 MockFile (org.apache.hadoop.hive.ql.io.orc.TestInputOutputFormat.MockFile)3 MockFileSystem (org.apache.hadoop.hive.ql.io.orc.TestInputOutputFormat.MockFileSystem)3 MockPath (org.apache.hadoop.hive.ql.io.orc.TestInputOutputFormat.MockPath)3 TxnInfo (org.apache.hadoop.hive.metastore.api.TxnInfo)1