xicm commented on code in PR #12392:
URL: https://github.com/apache/iceberg/pull/12392#discussion_r1967009129


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/MetastoreLock.java:
##########
@@ -372,15 +393,30 @@ private LockInfo findLock() throws LockException, 
InterruptedException {
     } catch (TException e) {
       throw new LockException(e, "Failed to find lock for table %s.%s", 
databaseName, tableName);
     }
-    for (ShowLocksResponseElement lock : response.getLocks()) {
-      if (lock.getAgentInfo().equals(agentInfo)) {
-        // We found our lock
-        return new LockInfo(lock.getLockid(), lock.getState());
+
+    return response.getLocks();
+  }
+
+  private void releaseExpiredHiveLock() throws LockException, 
InterruptedException {
+    long now = System.currentTimeMillis();
+    for (ShowLocksResponseElement lock : showLocks()) {
+      long lastHeartbeat = lock.getLastheartbeat();
+      if (now - lastHeartbeat > lockHeartbeatIntervalTime) {

Review Comment:
   Would a double heartbeats interval be safer?



-- 
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: issues-unsubscr...@iceberg.apache.org

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

Reply via email to