[ https://issues.apache.org/jira/browse/HIVE-24549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17251546#comment-17251546 ]
Adesh Kumar Rao commented on HIVE-24549: ---------------------------------------- [~jfs] If you are not planning to work on it, Can I assign it to myself? > TxnManager should not be shared across queries > ---------------------------------------------- > > Key: HIVE-24549 > URL: https://issues.apache.org/jira/browse/HIVE-24549 > Project: Hive > Issue Type: Bug > Components: HiveServer2 > Affects Versions: 4.0.0 > Reporter: John Sherman > Priority: Major > > There are various sections of code that assume the DbTxnManager is not shared > across concurrent queries in a session. > Such as (which gets invoked during closeOperation): > > [https://github.com/apache/hive/blob/3f5e01cae5b65dde7edb3fbde8ebe70c1d02f6cf/ql/src/java/org/apache/hadoop/hive/ql/Driver.java#L868-L885] > {code:java} > // is usually called after close() to commit or rollback a query and end > the driver life cycle. > // do not understand why it is needed and wonder if it could be combined > with close. > @Override > public void destroy() { > driverState.lock(); > try { > // in the cancel case where the driver state is INTERRUPTED, destroy > will be deferred to > // the query process > if (driverState.isDestroyed()) { > return; > } else { > driverState.descroyed(); > } > } finally { > driverState.unlock(); > } > driverTxnHandler.destroy(); > } > {code} > The problematic part is the: driverTxnHandler.destroy() which looks like: > {code:java} > void destroy() { > boolean isTxnOpen = > driverContext != null && > driverContext.getTxnManager() != null && > driverContext.getTxnManager().isTxnOpen(); > release(!hiveLocks.isEmpty() || isTxnOpen); > } > {code} > What happens is (rough sketch): > Q1 - starts operation, acquires txn, does operation, closes txn/cleans up > txn info, starts fetching data > Q2 - starts operation, acquire txn > Q1 - calls close operation which in turn calls destroy which sees the Q2s > transaction information and cleans it up. > Q2 - proceeds and fails in splitGeneration when it no longer can find its > Valid*TxnIdList information. -- This message was sent by Atlassian Jira (v8.3.4#803005)