This is an automated email from the ASF dual-hosted git repository.

codope pushed a commit to branch release-0.12.0
in repository https://gitbox.apache.org/repos/asf/hudi.git

commit 85b2612bbe82121325d2faa085b4767a06ea8053
Author: Sagar Sumit <[email protected]>
AuthorDate: Tue Aug 2 09:31:06 2022 +0530

    [HUDI-4518] Free lock if allocated but not acquired (#6272)
    
    If the lock is not null but its state has not yet transitioned to
    ACQUIRED, retry fails because the lock is not de-allocated.
    See issue https://github.com/apache/hudi/issues/5702
---
 .../hudi/hive/transaction/lock/HiveMetastoreBasedLockProvider.java      | 2 ++
 1 file changed, 2 insertions(+)

diff --git 
a/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/transaction/lock/HiveMetastoreBasedLockProvider.java
 
b/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/transaction/lock/HiveMetastoreBasedLockProvider.java
index aeeccf906f..328c8666a3 100644
--- 
a/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/transaction/lock/HiveMetastoreBasedLockProvider.java
+++ 
b/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/transaction/lock/HiveMetastoreBasedLockProvider.java
@@ -149,6 +149,7 @@ public class HiveMetastoreBasedLockProvider implements 
LockProvider<LockResponse
     try {
       if (lock != null) {
         hiveClient.unlock(lock.getLockid());
+        lock = null;
       }
       Hive.closeCurrent();
     } catch (Exception e) {
@@ -197,6 +198,7 @@ public class HiveMetastoreBasedLockProvider implements 
LockProvider<LockResponse
       // it is better to release WAITING lock, otherwise hive lock will hang 
forever
       if (this.lock != null && this.lock.getState() != LockState.ACQUIRED) {
         hiveClient.unlock(this.lock.getLockid());
+        lock = null;
       }
     }
   }

Reply via email to