private void acquire(MultiDataSourceJdbcResource jdbcResource, List<LockInfo> locksBeingChecked)
      throws NoSuchLockException, MetaException {
    if (CollectionUtils.isEmpty(locksBeingChecked)) {
      return;
    }
    long txnId = locksBeingChecked.get(0).getTxnId();
    long extLockId = locksBeingChecked.get(0).getExtLockId();
    int rc = jdbcResource.getJdbcTemplate().update("UPDATE \"HIVE_LOCKS\" SET \"HL_LOCK_STATE\" = :state, " +
        //if lock is part of txn, heartbeat info is in txn record
        "\"HL_LAST_HEARTBEAT\" = " + (TxnUtils.isValidTxn(txnId) ? 0 : getEpochFn(jdbcResource.getDatabaseProduct())) +
        ",\"HL_ACQUIRED_AT\" = " + getEpochFn(jdbcResource.getDatabaseProduct()) +
        ",\"HL_BLOCKEDBY_EXT_ID\"=NULL,\"HL_BLOCKEDBY_INT_ID\"=NULL" +
        " WHERE \"HL_LOCK_EXT_ID\" = :extLockId", 
        new MapSqlParameterSource()
            .addValue("state", Character.toString(LOCK_ACQUIRED), Types.CHAR)
            .addValue("extLockId", extLockId));
    
    if (rc < locksBeingChecked.size()) {
      LOG.error("Failure to acquire all locks (acquired: {}, total needed: {}).", rc, locksBeingChecked.size());
      /*select all locks for this ext ID and see which ones are missing*/
      Set<String> notFoundIds = locksBeingChecked.stream()
          .map(lockInfo -> Long.toString(lockInfo.getIntLockId()))
          .collect(Collectors.toSet());
      List<String> foundIds = Objects.requireNonNull(jdbcResource.getJdbcTemplate().query(
          "SELECT \"HL_LOCK_INT_ID\" FROM \"HIVE_LOCKS\" WHERE \"HL_LOCK_EXT_ID\" = :extLockId",
          new MapSqlParameterSource().addValue("extLockId", extLockId), rs -> {
            List<String> ids = new ArrayList<>();
            while (rs.next()) {
              ids.add(rs.getString("HL_LOCK_INT_ID"));
            }
            return ids;
          }), "This never should be null, it's just to suppress warnings");
      
      foundIds.forEach(notFoundIds::remove);
      String errorMsg = String.format("No such lock(s): (%s: %s) %s",
          JavaUtils.lockIdToString(extLockId), String.join(", ", notFoundIds), JavaUtils.txnIdToString(txnId));
      throw new NoSuchLockException(errorMsg);
    }
  }
EXCLUSIVE lock on partition should prevent SHARED_READ on the table, however there is no reason
        for an EXCLUSIVE on a table to prevent SHARED_READ on a database. Similarly, EXCLUSIVE on a partition
        should not conflict with SHARED_READ on a database.
        SHARED_READ is usually acquired on a database to make sure it's not dropped, while some operation
        is performed on that db (e.g. show tables, created table, etc).
        EXCLUSIVE on an object may mean it's being dropped or overwritten.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/jdbc/functions/CheckLockFunction.java