@Test
  public void compactExpiredAbortedTxns() throws Exception {
    boolean useCleanerForAbortCleanup = MetastoreConf.getBoolVar(conf, MetastoreConf.ConfVars.COMPACTOR_CLEAN_ABORTS_USING_CLEANER);
    Table t = newTable("default", "expiredAbortedTxns", false);
    // abort a txn
    long txnid = openTxn();
    LockComponent comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.TABLE, "default");
    comp.setOperationType(DataOperationType.DELETE);
    comp.setTablename("expiredAbortedTxns");
    List<LockComponent> components = new ArrayList<LockComponent>(1);
    components.add(comp);
    LockRequest req = new LockRequest(components, "me", "localhost");
    req.setTxnid(txnid);
    txnHandler.lock(req);
    txnHandler.abortTxn(new AbortTxnRequest(txnid));

    // before setting, check that no compaction is queued
    initiateAndVerifyCompactionQueueLength(0);

    // negative number disables threshold check
    conf.setTimeVar(HiveConf.ConfVars.HIVE_COMPACTOR_ABORTEDTXN_TIME_THRESHOLD, -1,
        TimeUnit.MILLISECONDS);
    Thread.sleep(1L);
    initiateAndVerifyCompactionQueueLength(0);

    // set to 1 ms, wait 1 ms, and check that minor compaction is queued
    conf.setTimeVar(HiveConf.ConfVars.HIVE_COMPACTOR_ABORTEDTXN_TIME_THRESHOLD, 1, TimeUnit.MILLISECONDS);
    Thread.sleep(1L);
    if (useCleanerForAbortCleanup) {
      initiateAndVerifyCompactionQueueLength(0);
    } else {
      ShowCompactResponse rsp = initiateAndVerifyCompactionQueueLength(1);
      Assert.assertEquals(CompactionType.MINOR, rsp.getCompacts().get(0).getType());
    }
  }
Test that HiveConf.ConfVars.HIVE_COMPACTOR_ABORTEDTXN_TIME_THRESHOLD triggers compaction.

@throws Exception
ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestInitiator.java