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

    driver.run("create table target (a int, b int) stored as orc TBLPROPERTIES ('transactional'='true')");
    driver.run("insert into target values (1,2), (3,4)");
    driver.run("create table source (a int, b int)");
    driver.run("insert into source values (5,6), (7,8)");

    if (!slowCompile) {
      driver.compileAndRespond("update target set a=5 where a=1");
    }

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

    swapTxnManager(txnMgr);
    if (!slowCompile) {
      driver.run();
    } else {
      driver.run("update target set a=5 where a=1");
    }

    swapTxnManager(txnMgr2);
    driver2.run();

    swapTxnManager(txnMgr);
    driver.run("select * from target");
    List<String> res = new ArrayList<>();
    driver.getFetchTask().fetch(res);
    Assert.assertEquals(2, res.size());
    Assert.assertEquals("Lost Update", "5\t8", res.get(1));
  }
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