@Test
  public void majorCompactOnPartitionTooManyAborts() throws Exception {
    boolean useCleanerForAbortCleanup = MetastoreConf.getBoolVar(conf, MetastoreConf.ConfVars.COMPACTOR_CLEAN_ABORTS_USING_CLEANER);
    Table t = newTable("default", "mcoptma", true);
    Partition p = newPartition(t, "today");

    HiveConf.setIntVar(conf, HiveConf.ConfVars.HIVE_COMPACTOR_ABORTEDTXN_THRESHOLD, 10);

    for (int i = 0; i < 11; i++) {
      long txnid = openTxn();
      LockComponent comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.TABLE, "default");
      comp.setTablename("mcoptma");
      comp.setPartitionname("ds=today");
      comp.setOperationType(DataOperationType.DELETE);
      List<LockComponent> components = new ArrayList<LockComponent>(1);
      components.add(comp);
      LockRequest req = new LockRequest(components, "me", "localhost");
      req.setTxnid(txnid);
      LockResponse res = txnHandler.lock(req);
      txnHandler.abortTxn(new AbortTxnRequest(txnid));
    }

    startInitiator();

    ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest());
    List<ShowCompactResponseElement> compacts = rsp.getCompacts();
    if (useCleanerForAbortCleanup) {
      Assert.assertEquals(0, compacts.size());
    } else {
      Assert.assertEquals(1, compacts.size());
      Assert.assertEquals("initiated", compacts.get(0).getState());
      Assert.assertEquals("mcoptma", compacts.get(0).getTablename());
      Assert.assertEquals("ds=today", compacts.get(0).getPartitionname());
      Assert.assertEquals(CompactionType.MAJOR, compacts.get(0).getType());
    }
  }
Tests for the compactor Initiator thread.
ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestInitiator.java