You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by le...@apache.org on 2021/06/05 11:41:02 UTC

[hudi] branch master updated: [HUDI-1979] Optimize logic to improve code readability (#3037)

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

leesf 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 dab13f7  [HUDI-1979] Optimize logic to improve code readability (#3037)
dab13f7 is described below

commit dab13f7473cfe4fad42189056e4c931ee2e2a297
Author: Wei <hs...@163.com>
AuthorDate: Sat Jun 5 19:40:45 2021 +0800

    [HUDI-1979] Optimize logic to improve code readability (#3037)
    
    Co-authored-by: wei.zhang2 <we...@dmall.com>
---
 .../java/org/apache/hudi/hive/HiveMetastoreBasedLockProvider.java  | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HiveMetastoreBasedLockProvider.java b/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HiveMetastoreBasedLockProvider.java
index 593adc2..9b5a1b0 100644
--- a/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HiveMetastoreBasedLockProvider.java
+++ b/hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HiveMetastoreBasedLockProvider.java
@@ -184,18 +184,13 @@ public class HiveMetastoreBasedLockProvider implements LockProvider<LockResponse
       this.lock = executor.submit(() -> hiveClient.lock(lockRequestFinal))
           .get(time, unit);
     } catch (InterruptedException | TimeoutException e) {
-      if (this.lock != null && this.lock.getState() == LockState.ACQUIRED) {
-        return;
-      } else if (lockRequest != null) {
+      if (this.lock == null || this.lock.getState() != LockState.ACQUIRED) {
         LockResponse lockResponse = this.hiveClient.checkLock(lockRequest.getTxnid());
         if (lockResponse.getState() == LockState.ACQUIRED) {
           this.lock = lockResponse;
-          return;
         } else {
           throw e;
         }
-      } else {
-        throw e;
       }
     }
   }