addFailedCompaction("foo", "bar", CompactionType.MINOR, "ds=today"); addFailedCompaction("foo", "bar", CompactionType.MINOR, "ds=today");
@Test public void testFindNextToCompact() throws Exception { CompactionRequest rqst = new CompactionRequest("foo", "bar", CompactionType.MINOR); rqst.setPartitionname("ds=today"); txnHandler.compact(rqst); long now = System.currentTimeMillis(); CompactionInfo ci = txnHandler.findNextToCompact("fred"); assertNotNull(ci); assertEquals("foo", ci.dbname); assertEquals("bar", ci.tableName); assertEquals("ds=today", ci.partName); assertEquals(CompactionType.MINOR, ci.type); assertNull(ci.runAs); assertNull(txnHandler.findNextToCompact("fred")); ci.runAs = "bob"; txnHandler.updateCompactorState(ci, openTxn()); ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest()); List<ShowCompactResponseElement> compacts = rsp.getCompacts(); assertEquals(1, compacts.size()); ShowCompactResponseElement c = compacts.get(0); assertEquals("foo", c.getDbname()); assertEquals("bar", c.getTablename()); assertEquals("ds=today", c.getPartitionname()); assertEquals(CompactionType.MINOR, c.getType()); assertEquals("working", c.getState()); assertTrue(c.getStart() - 5000 < now && c.getStart() + 5000 > now); assertEquals("fred", c.getWorkerid()); assertEquals("bob", c.getRunAs()); }
public TestCompactionTxnHandler() throws Exception { TxnDbUtil.setConfValues(conf); // Set config so that TxnUtils.buildQueryWithINClauseStrings() will // produce multiple queries conf.setIntVar(HiveConf.ConfVars.METASTORE_DIRECT_SQL_MAX_QUERY_LENGTH, 1); conf.setIntVar(HiveConf.ConfVars.METASTORE_DIRECT_SQL_MAX_ELEMENTS_IN_CLAUSE, 10); tearDown(); }
@Test public void testFindPotentialCompactions() throws Exception { long txnid = openTxn(); LockComponent comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.DB, "mydb");
@Test public void testMarkCleanedCleansTxnsAndTxnComponents() throws Exception { long txnid = openTxn(); LockComponent comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.DB, "mydb"); txnHandler.abortTxn(new AbortTxnRequest(txnid)); txnid = openTxn(); comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.DB, "mydb"); comp.setTablename("yourtable"); txnHandler.abortTxn(new AbortTxnRequest(txnid)); txnid = openTxn(); comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.DB, "mydb"); comp.setTablename("foo");