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);
}
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);
}
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());
}
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);
}
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);
}
Aggregations