@Override
  public void abortTxns(AbortTxnsRequest rqst) throws MetaException {
    List<Long> txnIds = rqst.getTxn_ids();
    TxnErrorMsg txnErrorMsg = TxnErrorMsg.NONE;
    if (rqst.isSetErrorCode()) {
      txnErrorMsg = TxnErrorMsg.getTxnErrorMsg(rqst.getErrorCode());
    }

    List<String> queries = new ArrayList<>();
    StringBuilder prefix =
        new StringBuilder("SELECT \"TXN_ID\", \"TXN_TYPE\" from \"TXNS\" where \"TXN_STATE\" = ")
            .append(TxnStatus.OPEN)
            .append(" and \"TXN_TYPE\" != ").append(TxnType.READ_ONLY.getValue()).append(" and ");

    TxnUtils.buildQueryWithINClause(conf, queries, prefix, new StringBuilder(),
        txnIds, "\"TXN_ID\"", false, false);

    Connection dbConn = jdbcResource.getConnection();
    try {
      Map<Long, TxnType> nonReadOnlyTxns = new HashMap<>();
      for (String query : queries) {
        LOG.debug("Going to execute query <{}>", query);
        try (Statement stmt = dbConn.createStatement(); ResultSet rs = stmt.executeQuery(sqlGenerator.addForUpdateClause(query))) {
          while (rs.next()) {
            TxnType txnType = TxnType.findByValue(rs.getInt(2));
            nonReadOnlyTxns.put(rs.getLong(1), txnType);
          }
        }
      }
      int numAborted = new AbortTxnsFunction(txnIds, false, false, false, txnErrorMsg).execute(jdbcResource); 
      if (numAborted != txnIds.size()) {
        LOG.warn(
            "Abort Transactions command only aborted {} out of {} transactions. It's possible that the other"
                + " {} transactions have been aborted or committed, or the transaction ids are invalid.",
            numAborted, txnIds.size(), (txnIds.size() - numAborted));
      }

      if (transactionalListeners != null) {
        for (Long txnId : txnIds) {
          List<String> dbsUpdated = getTxnDbsUpdated(txnId);
          MetaStoreListenerNotifier.notifyEventWithDirectSql(transactionalListeners,
              EventMessage.EventType.ABORT_TXN, new AbortTxnEvent(txnId,
                  nonReadOnlyTxns.getOrDefault(txnId, TxnType.READ_ONLY), null, dbsUpdated), dbConn, sqlGenerator);
        }
      }
    } catch (SQLException e) {
      throw new UncategorizedSQLException(null, null, e);
    }
  }
Retry-by-caller note:
Worst case, it will leave an open txn which will timeout.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java