private void testConcurrent2MergeUpdatesConflict(boolean slowCompile) throws Exception {
    dropTable(new String[]{"target", "source"});
    driver2.getConf().setBoolVar(HiveConf.ConfVars.TXN_WRITE_X_LOCK, true);

    driver.run("create table target (name string, age int) stored as orc TBLPROPERTIES('transactional'='true')");
    driver.run("insert into target values ('amy', 88), ('drake', 44), ('earl', 21)");
    driver.run("create table source (name string, age int) stored as orc TBLPROPERTIES('transactional'='true')");
    driver.run("insert into source values ('amy', 35), ('bob', 66), ('cal', 21)");

    if (!slowCompile) {
      driver.compileAndRespond("merge into target t using source s on t.name = s.name " +
        "when matched then update set age=10");
    }

    DbTxnManager txnMgr2 = (DbTxnManager) TxnManagerFactory.getTxnManagerFactory().getTxnManager(conf);
    swapTxnManager(txnMgr2);
    driver2.compileAndRespond("merge into target t using source s on t.age = s.age " +
      "when matched then update set age=10");

    swapTxnManager(txnMgr);
    if (!slowCompile) {
      driver.run();
    } else {
      driver.run("merge into target t using source s on t.name = s.name " +
        "when matched then update set age=10");
    }

    swapTxnManager(txnMgr2);
    driver2.run();

    swapTxnManager(txnMgr);
    driver.run("select * from target where age=10");
    List<String> res = new ArrayList<>();
    driver.getFetchTask().fetch(res);
    Assert.assertEquals(2, res.size());
    Assert.assertTrue("Lost Update", isEqualCollection(res, asList("earl\t10", "amy\t10")));
  }
run a merge statement using un-partitioned target table and a concurrent op on the target
Check that proper locks are acquired and Write conflict detection works and the state
of internal table.
@param causeConflict true to make 2 operations such that they update the same entity
ql/src/test/org/apache/hadoop/hive/ql/lockmgr/TestDbTxnManager2.java