ZorTsou commented on a change in pull request #2263: URL: https://github.com/apache/iceberg/pull/2263#discussion_r581001076
########## File path: hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java ########## @@ -348,16 +345,15 @@ private long acquireLock() throws UnknownHostException, TException, InterruptedE LOG.warn("Interrupted while waiting for lock.", e); } }, TException.class); - } catch (WaitingForLockException waitingForLockException) { - timeout = true; - duration = System.currentTimeMillis() - start; } - } - - // timeout and do not have lock acquired - if (timeout && !state.get().equals(LockState.ACQUIRED)) { + } catch (WaitingForLockException waitingForLockException) { + // timeout and do not have lock acquired throw new CommitFailedException("Timed out after %s ms waiting for lock on %s.%s", - duration, database, tableName); + System.currentTimeMillis() - start, database, tableName); + } finally { + if (!state.get().equals(LockState.ACQUIRED)) { + unlock(Optional.of(lockId)); + } Review comment: I agree. It looks more clear. I updated the code, thanks. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org