tarak271 commented on code in PR #4805: URL: https://github.com/apache/hive/pull/4805#discussion_r1410624500
########## standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java: ########## @@ -5835,12 +5836,24 @@ public void performTimeOuts() { Object savePoint = context.getTransactionStatus().createSavepoint(); int numTxnsAborted = 0; - for (List<Long> batchToAbort : timedOutTxns) { + for (Map<Long, Integer> batchToAbort : timedOutTxns) { context.getTransactionStatus().releaseSavepoint(savePoint); savePoint = context.getTransactionStatus().createSavepoint(); - if (abortTxns(jdbcResource.getConnection(), batchToAbort, true, false, false, TxnErrorMsg.ABORT_TIMEOUT) == batchToAbort.size()) { + if (abortTxns(jdbcResource.getConnection(), new ArrayList<>(batchToAbort.keySet()), true, false, false, TxnErrorMsg.ABORT_TIMEOUT) == batchToAbort.size()) { numTxnsAborted += batchToAbort.size(); //todo: add TXNS.COMMENT filed and set it to 'aborted by system due to timeout' + LOG.info("Aborted the following transactions due to timeout: {}", batchToAbort); + if (transactionalListeners != null) { + for (Map.Entry<Long, Integer> txnEntry : batchToAbort.entrySet()) { + List<String> dbsUpdated = getTxnDbsUpdated(txnEntry.getKey(), jdbcResource.getConnection()); + MetaStoreListenerNotifier.notifyEventWithDirectSql(transactionalListeners, + EventMessage.EventType.ABORT_TXN, + new AbortTxnEvent(txnEntry.getKey(), TxnType.findByValue(txnEntry.getValue()), null, dbsUpdated), + jdbcResource.getConnection(), sqlGenerator); + } + jdbcResource.getConnection().commit(); Review Comment: Removed commit call, as we are already doing commit once txns to aborted become empty in the while loop at ``` //noinspection DataFlowIssue if (timedOutTxns.size() == 0) { jdbcResource.getTransactionManager().commit(context); return; } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org