private void testGetMaterializationInvalidationInfo(
          ValidReadTxnList currentValidTxnList, ValidReaderWriteIdList... tableWriteIdList) throws MetaException {
    ValidTxnWriteIdList validTxnWriteIdList = new ValidTxnWriteIdList(5L);
    for (ValidReaderWriteIdList tableWriteId : tableWriteIdList) {
      validTxnWriteIdList.addTableValidWriteIdList(tableWriteId);
    }

    Table table = new Table();
    table.setDbName("default");
    table.setTableName("t1");
    HashMap<String, String> tableParameters = new HashMap<String, String>() {{
      put(TABLE_IS_TRANSACTIONAL, "true");
      put(TABLE_TRANSACTIONAL_PROPERTIES, "insert_only");
    }};
    table.setParameters(tableParameters);
    SourceTable sourceTable = new SourceTable();
    sourceTable.setTable(table);
    CreationMetadata creationMetadata = new CreationMetadata();
    creationMetadata.setDbName("default");
    creationMetadata.setTblName("mat1");
    creationMetadata.setTablesUsed(new HashSet<String>() {{ add("default.t1"); }});
    creationMetadata.setValidTxnList(validTxnWriteIdList.toString());

    Materialization materialization = txnHandler.getMaterializationInvalidationInfo(
            creationMetadata, currentValidTxnList.toString());
    assertFalse(materialization.isSourceTablesUpdateDeleteModified());
  }
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