List<Long> allocateWriteIdsForTablesAndAcquireLocks(String primaryDbName, Map<String, Long> tables,
                                                     TxnStore txnHandler,
                                                     List<Long> txns, HiveConf primaryConf) throws Throwable {
    AllocateTableWriteIdsRequest rqst = new AllocateTableWriteIdsRequest();
    rqst.setDbName(primaryDbName);
    List<Long> lockIds = new ArrayList<>();
    for(Map.Entry<String, Long> entry : tables.entrySet()) {
      rqst.setTableName(entry.getKey());
      rqst.setTxnIds(txns);
      txnHandler.allocateTableWriteIds(rqst);
      for (long txnId : txns) {
        LockComponent comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.TABLE,
          primaryDbName);
        comp.setTablename(entry.getKey());
        comp.setOperationType(DataOperationType.UPDATE);
        List<LockComponent> components = new ArrayList<LockComponent>(1);
        components.add(comp);
        LockRequest lockRequest = new LockRequest(components, "u1", "hostname");
        lockRequest.setTxnid(txnId);
        lockIds.add(txnHandler.lock(lockRequest).getLockid());
      }
    }
    verifyWriteIdsForTables(tables, primaryConf, primaryDbName);
    return lockIds;
  }
TestReplicationScenariosAcidTablesBase - base class for replication for ACID tables tests
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/BaseReplicationScenariosAcidTables.java