Aggarwal-Raghav commented on PR #6604:
URL: https://github.com/apache/hive/pull/6604#issuecomment-4972549838

   @deniskuzZ , can you please share the repo case/stacktrace of error you 
faced? I faced the above stacktrace **today in prod as per timestamp**. 
[HIVE-28669](https://issues.apache.org/jira/browse/HIVE-28669) is backported in 
4.0.1 in my case.
   
   So I was thinking of this in `acquireLock()`? _Did you face this or my 
stacktrace is different or maybe they are two halves of the same coin?_
   ```
   diff --git 
i/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnStoreMutex.java
 
w/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnStoreMutex.java
   index 3dad12fc1f..8ea4b0cbd9 100644
   --- 
i/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnStoreMutex.java
   +++ 
w/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnStoreMutex.java
   @@ -81,7 +81,14 @@ public LockHandle acquireLock(String key) throws 
MetaException {
              jdbcResource.getJdbcTemplate().update("INSERT INTO \"AUX_TABLE\" 
(\"MT_KEY1\", \"MT_KEY2\") VALUES(:key, 0)", paramSource);
              context.createSavepoint();
            } catch (DataAccessException e) {
   -          if (!jdbcResource.getDatabaseProduct().isDuplicateKeyError(e)) {
   +          boolean isDeadlock = false;
   +          try {
   +            isDeadlock = 
jdbcResource.getDatabaseProduct().isDeadlock(TxnUtils.getSqlException(e));
   +          } catch (IllegalArgumentException ex) {
   +            // Ignore if we can't extract a SQLException
   +          }
   +
   +          if (!jdbcResource.getDatabaseProduct().isDuplicateKeyError(e) && 
!isDeadlock) {
                throw new RuntimeException("Unable to lock " + key + " due to: 
" + SqlRetryHandler.getMessage(e), e);
              }
              //if here, it means a concrurrent acquireLock() inserted the 'key'
   
   ```


-- 
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