private void testFairness(boolean zeroWaitRead) throws Exception {
    dropTable(new String[]{"T6"});
    MetastoreConf.setBoolVar(conf, MetastoreConf.ConfVars.CREATE_TABLES_AS_ACID, zeroWaitRead);
    conf.setBoolVar(HiveConf.ConfVars.TXN_WRITE_X_LOCK, !zeroWaitRead);
    driver.run("create table if not exists T6 (a int) stored as ORC");
    driver.compileAndRespond("select a from T6", true);
    txnMgr.acquireLocks(driver.getPlan(), ctx, "Fifer"); //gets S lock on T6
    HiveTxnManager txnMgr2 = TxnManagerFactory.getTxnManagerFactory().getTxnManager(conf);
    swapTxnManager(txnMgr2);
    driver.compileAndRespond("drop table if exists T6", true);
    //tries to get X lock on T6 and gets Waiting state
    ((DbTxnManager) txnMgr2).acquireLocks(driver.getPlan(), ctx, "Fiddler", false);
    List<ShowLocksResponseElement> locks = getLocks();
    Assert.assertEquals("Unexpected lock count", 3, locks.size());
    TestTxnDbUtil.checkLock(LockType.SHARED_READ, LockState.ACQUIRED, "default", "T6", null, locks);
    long extLockId = TestTxnDbUtil.checkLock(LockType.EXCLUSIVE, LockState.WAITING, "default", "T6", null, locks).getLockid();

    HiveTxnManager txnMgr3 = TxnManagerFactory.getTxnManagerFactory().getTxnManager(conf);
    swapTxnManager(txnMgr3);
    //this should block behind the X lock on  T6
    //this is a contrived example, in practice this query would of course fail after drop table
    driver.compileAndRespond("select a from T6", true);
    try {
      ((DbTxnManager) txnMgr3).acquireLocks(driver.getPlan(), ctx, "Fifer", false); //gets S lock on T6
    } catch (LockException ex) {
      Assert.assertTrue(zeroWaitRead);
      Assert.assertEquals("Exception msg didn't match",
        ErrorMsg.LOCK_CANNOT_BE_ACQUIRED.getMsg() + " LockResponse(lockid:" + (extLockId + 1) +
          ", state:NOT_ACQUIRED, errorMessage:Unable to acquire read lock due to an existing exclusive lock" +
          " {lockid:" + extLockId + " intLockId:1 txnid:" + txnMgr2.getCurrentTxnId() +
          " db:default table:t6 partition:null state:WAITING type:EXCLUSIVE})",
        ex.getMessage());
    }
    locks = getLocks();
    Assert.assertEquals("Unexpected lock count", (zeroWaitRead ? 3 : 4), locks.size());
    TestTxnDbUtil.checkLock(LockType.SHARED_READ, LockState.ACQUIRED, "default", "T6", null, locks);
    if (!zeroWaitRead) {
      TestTxnDbUtil.checkLock(LockType.SHARED_READ, LockState.WAITING, "default", "T6", null, locks);
    }
    TestTxnDbUtil.checkLock(LockType.EXCLUSIVE, LockState.WAITING, "default", "T6", null, locks);
  }
This test is mostly obsolete.  The logic in the Driver.java no longer acquires any locks for
"show tables".  Keeping the test for now in case we change that logic.
ql/src/test/org/apache/hadoop/hive/ql/lockmgr/TestDbTxnManager2.java