pvary commented on a change in pull request #1222: URL: https://github.com/apache/hive/pull/1222#discussion_r453155258
########## File path: ql/src/java/org/apache/hadoop/hive/ql/DriverTxnHandler.java ########## @@ -529,6 +529,34 @@ private void addTableFromEntity(Entity entity, Map<String, Table> tables) { .collect(Collectors.toList()); } + void rollback(CommandProcessorException cpe) throws CommandProcessorException { + try { + releaseLocksAndCommitOrRollback(false); + } catch (LockException e) { + LOG.error("rollback() FAILED: " + cpe); //make sure not to loose + DriverUtils.handleHiveException(driverContext, e, 12, "Additional info in hive.log at \"rollback() FAILED\""); + } + } + + void handleTransactionAfterExecution() throws CommandProcessorException { + try { + if (driverContext.getTxnManager().isImplicitTransactionOpen() || + driverContext.getPlan().getOperation() == HiveOperation.COMMIT) { + releaseLocksAndCommitOrRollback(true); + } else if (driverContext.getPlan().getOperation() == HiveOperation.ROLLBACK) { + releaseLocksAndCommitOrRollback(false); + } else if (!driverContext.getTxnManager().isTxnOpen() && + driverContext.getQueryState().getHiveOperation() == HiveOperation.REPLLOAD) { + // repl load during migration, commits the explicit txn and start some internal txns. Call + // releaseLocksAndCommitOrRollback to do the clean up. + releaseLocksAndCommitOrRollback(false); + } + // if none of the above is true, then txn (if there is one started) is not finished Review comment: How could this happen? Maybe at least a debug level log would be good. ---------------------------------------------------------------- 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. 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