This is an automated email from the ASF dual-hosted git repository.
codope pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git
The following commit(s) were added to refs/heads/master by this push:
new 251b63ef0b [HUDI-4518] Free lock if allocated but not acquired (#6272)
251b63ef0b is described below
commit 251b63ef0bfc97a153a27d2eae55b04f22c89533
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;
}
}
}