leesf commented on code in PR #7440: URL: https://github.com/apache/hudi/pull/7440#discussion_r1048440918
########## hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/FileSystemBasedLockProvider.java: ########## @@ -139,7 +152,31 @@ private boolean checkIfExpired() { private void acquireLock() { try { - fs.create(this.lockFile, false).close(); + if (!fs.exists(this.lockFile)) { + FSDataOutputStream fos = fs.create(this.lockFile, false); + initLockInfo(); + fos.writeBytes(lockInfo.toString()); + fos.close(); + } + } catch (IOException e) { + throw new HoodieIOException(generateLogStatement(LockState.FAILED_TO_ACQUIRE), e); + } + } + + public void initLockInfo() { + lockInfo.setLockCreateTime(sdf.format(System.currentTimeMillis())); + lockInfo.setLockThreadName(Thread.currentThread().getName()); + lockInfo.setLockStacksInfo(Thread.currentThread().getStackTrace()); + } + + public void reloadCurrentOwnerLockInfo() { + try { + if (fs.exists(this.lockFile)) { + FSDataInputStream fis = fs.open(this.lockFile); Review Comment: the inputstream will not be closed? -- 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-unsubscr...@hudi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org