[ 
https://issues.apache.org/jira/browse/HIVE-26121?focusedWorklogId=753312&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-753312
 ]

ASF GitHub Bot logged work on HIVE-26121:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 06/Apr/22 11:27
            Start Date: 06/Apr/22 11:27
    Worklog Time Spent: 10m 
      Work Description: deniskuzZ commented on code in PR #3181:
URL: https://github.com/apache/hive/pull/3181#discussion_r843829613


##########
ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbTxnManager.java:
##########
@@ -574,30 +571,24 @@ public void rollbackTxn() throws LockException {
     if (!isTxnOpen()) {
       throw new RuntimeException("Attempt to rollback before opening a 
transaction");
     }
-    stopHeartbeat();
-
     try {
-      lockMgr.clearLocalLockRecords();
+      clearLocksAndHB();
       LOG.debug("Rolling back " + JavaUtils.txnIdToString(txnId));
-
-      // Re-checking as txn could have been closed, in the meantime, by a 
competing thread.
-      if (isTxnOpen()) {
-        if (replPolicy != null) {
-          getMS().replRollbackTxn(txnId, replPolicy, TxnType.DEFAULT);
-        } else {
-          getMS().rollbackTxn(txnId);
-        }
+      
+      if (replPolicy != null) {

Review Comment:
   marked as @NotThreadSafe





Issue Time Tracking
-------------------

    Worklog Id:     (was: 753312)
    Time Spent: 20m  (was: 10m)

> Hive transaction rollback should be thread-safe
> -----------------------------------------------
>
>                 Key: HIVE-26121
>                 URL: https://issues.apache.org/jira/browse/HIVE-26121
>             Project: Hive
>          Issue Type: Task
>            Reporter: Denys Kuzmenko
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> When Hive query is being interrupted via cancel request, both the background 
> pool thread (HiveServer2-Background) executing the query and the HttpHandler 
> thread (HiveServer2-Handler) running the HiveSession.cancelOperation logic 
> will eventually trigger the below method:
> {code}
> DriverTxnHandler.endTransactionAndCleanup(boolean commit)
> {code}
> Since this method could be invoked concurrently we need to synchronize access 
> to it, so that only 1 thread would attempt to abort the transaction and stop 
> the heartbeat.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to