deniskuzZ commented on code in PR #3307:
URL: https://github.com/apache/hive/pull/3307#discussion_r901397117


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java:
##########
@@ -5280,23 +5291,24 @@ is performed on that db (e.g. show tables, created 
table, etc).
         LOG.debug("Failure to acquire lock({} intLockId:{} {}), blocked by 
({})", JavaUtils.lockIdToString(extLockId),
             intLockId, JavaUtils.txnIdToString(txnId), blockedBy);
 
-        if (zeroWaitReadEnabled && isValidTxn(txnId)) {
+        if ((zeroWaitReadEnabled || isExclusiveCTAS) && isValidTxn(txnId)) {
           LockType lockType = LockTypeUtil.getLockTypeFromEncoding(lockChar)
-              .orElseThrow(() -> new MetaException("Unknown lock type: " + 
lockChar));
-
-          if (lockType == LockType.SHARED_READ) {
-            String cleanupQuery = "DELETE FROM \"HIVE_LOCKS\" WHERE 
\"HL_LOCK_EXT_ID\" = " + extLockId;
+                  .orElseThrow(() -> new MetaException("Unknown lock type: " + 
lockChar));
 
-            LOG.debug("Going to execute query: <" + cleanupQuery + ">");
-            stmt.executeUpdate(cleanupQuery);
+          if (lockType == LockType.SHARED_READ || isExclusiveCTAS) {
+            if (!isExclusiveCTAS) {

Review Comment:
   delete from HIVE_LOCKS should be done for isExclusiveCTAS as well



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to