@Test
  public void testReplOpenTxn() throws Exception {
    createDatabaseForReplTests("default", MetaStoreUtils.getDefaultCatalog(conf));
    int numTxn = 50000;
    String[] output = TestTxnDbUtil.queryToString(conf, "SELECT MAX(\"TXN_ID\") + 1 FROM \"TXNS\"").split("\n");
    long startTxnId = Long.parseLong(output[1].trim());
    txnHandler.setOpenTxnTimeOutMillis(50000);
    List<Long> txnList = replOpenTxnForTest(startTxnId, numTxn, "default.*");
    txnHandler.setOpenTxnTimeOutMillis(1000);
    assert(txnList.size() == numTxn);
    txnHandler.abortTxns(new AbortTxnsRequest(txnList));
  }
counter = 0;
Thread1 counter=1, lock, wait 3s, check counter(should be 2), counter=3, unlock
Thread2 counter=2, lock (and block), inc counter, should be 4
ql/src/test/org/apache/hadoop/hive/metastore/txn/TestTxnHandler.java