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

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

                Author: ASF GitHub Bot
            Created on: 15/Jun/22 19:39
            Start Date: 15/Jun/22 19:39
    Worklog Time Spent: 10m 
      Work Description: simhadri-g commented on code in PR #3307:
URL: https://github.com/apache/hive/pull/3307#discussion_r898344710


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java:
##########
@@ -5297,6 +5303,28 @@ is performed on that db (e.g. show tables, created 
table, etc).
             return response;
           }
         }
+
+        if (checkForConcurrentCtas && isValidTxn(txnId)) {
+          LockType lockType = LockTypeUtil.getLockTypeFromEncoding(lockChar)
+                  .orElseThrow(() -> new MetaException("Unknown lock type: " + 
lockChar));
+
+          if (lockType == LockType.EXCL_WRITE && blockedBy.state == 
LockState.ACQUIRED) {
+
+            String deleteBlockedByTxnComp = "DELETE  FROM \"TXN_COMPONENTS\" 
WHERE" + " \"TC_TXNID\"=" + txnId;

Review Comment:
   No, txn abort still leaves behind entries in TXN_COMPONENTS . 
   This happens even when an insert query is aborted. Looks like a bug.
   
   Below TXN_ID = 2  was aborted. But TXN_COMPONENTS still has entry.
   ```
   mysql> select * from TXNS;
   
+--------+-----------+---------------+--------------------+----------+-----------+----------------+---------------+---------------------+----------+
   | TXN_ID | TXN_STATE | TXN_STARTED   | TXN_LAST_HEARTBEAT | TXN_USER | 
TXN_HOST  | TXN_AGENT_INFO | TXN_META_INFO | TXN_HEARTBEAT_COUNT | TXN_TYPE |
   
+--------+-----------+---------------+--------------------+----------+-----------+----------------+---------------+---------------------+----------+
   |      0 | c         |             0 |                  0 |          |       
    | NULL           | NULL          |                NULL |     NULL |
   |      1 | c         | 1655320638716 |      1655320638716 | hive     | 
localhost | NULL           | NULL          |                NULL |        0 |
   |      2 | a         | 1655320644989 |      1655320664896 | hive     | 
localhost | NULL           | NULL          |                NULL |        0 |
   |      3 | c         | 1655320688403 |      1655320688403 | hive     | 
localhost | NULL           | NULL          |                NULL |        0 |
   |      4 | c         | 1655320719660 |      1655320719660 | hive     | 
localhost | NULL           | NULL          |                NULL |        0 |
   
   
   mysql> select * from TXN_COMPONENTS;
   
+----------+-------------+----------+--------------+-------------------+------------+
   | TC_TXNID | TC_DATABASE | TC_TABLE | TC_PARTITION | TC_OPERATION_TYPE | 
TC_WRITEID |
   
+----------+-------------+----------+--------------+-------------------+------------+
   |        2 | default     | t1       | NULL         | i                 |     
     1 |
   
+----------+-------------+----------+--------------+-------------------+------------+
   1 row in set (0.00 sec)
   ```





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

    Worklog Id:     (was: 781806)
    Time Spent: 6.5h  (was: 6h 20m)

> Implementing locking for concurrent ctas
> ----------------------------------------
>
>                 Key: HIVE-26244
>                 URL: https://issues.apache.org/jira/browse/HIVE-26244
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Simhadri G
>            Assignee: Simhadri G
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 6.5h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to