You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/07/29 09:59:47 UTC

[GitHub] [hudi] danny0405 commented on a diff in pull request #6242: [HUDI-4505] Returns instead of throws if lock file exists for FileSys…

danny0405 commented on code in PR #6242:
URL: https://github.com/apache/hudi/pull/6242#discussion_r933075366


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/FileSystemBasedLockProvider.java:
##########
@@ -87,8 +87,13 @@ public boolean tryLock(long time, TimeUnit unit) {
     try {
       synchronized (LOCK_FILE_NAME) {
         // Check whether lock is already expired, if so try to delete lock file
-        if (fs.exists(this.lockFile) && checkIfExpired()) {
-          fs.delete(this.lockFile, true);
+        if (fs.exists(this.lockFile)) {
+          if (checkIfExpired()) {
+            fs.delete(this.lockFile, true);
+            LOG.warn("Delete expired lock file: " + this.lockFile);
+          } else {
+            return false;

Review Comment:
   It should be covered by `#testReentrantLock`



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org