pvary commented on code in PR #13795:
URL: https://github.com/apache/iceberg/pull/13795#discussion_r2276358936


##########
flink/v2.0/flink/src/main/java/org/apache/iceberg/flink/maintenance/api/ZkLockFactory.java:
##########
@@ -126,29 +159,46 @@ public void close() throws IOException {
       if (client != null) {
         client.close();
       }
+      isOpen = false;
     }
   }
 
   /** Zookeeper lock implementation */
   private static class ZkLock implements Lock {
     private final SharedCount sharedCount;
+    private final String lockId;
+    private final String lockType;
+    private final String lockPath;
+
+    private static final int LOCKED = 1;
+    private static final int UNLOCKED = 0;
 
-    private ZkLock(SharedCount sharedCount) {
+    private ZkLock(String lockId, String lockType, String lockPath, 
SharedCount sharedCount) {
+      this.lockId = lockId;
+      this.lockType = lockType;
+      this.lockPath = lockPath;
       this.sharedCount = sharedCount;
     }
 
     @Override
     public boolean tryLock() {
       VersionedValue<Integer> versionedValue = sharedCount.getVersionedValue();
       if (isHeld(versionedValue)) {
-        LOG.debug("Lock is already held for {}", this);
+        LOG.debug(
+            "Lock is already held for lockId: {}, type: {}, path: {}.", 
lockId, lockType, lockPath);
         return false;
       }
 
       try {
-        return sharedCount.trySetCount(versionedValue, LOCKED);
+        boolean acquired = sharedCount.trySetCount(versionedValue, LOCKED);
+        if (!acquired) {
+          LOG.warn(
+              "Failed to acquire {} lock for lockId: {}, path: {}", lockType, 
lockId, lockPath);
+        }
+
+        return acquired;
       } catch (Exception e) {
-        LOG.debug("Failed to acquire Zookeeper lock ", e);
+        LOG.error("Failed to acquire Zookeeper lock.", e);

Review Comment:
   When could we get these exceptions?
   This could help find the correct log levels: 
https://betterstack.com/community/guides/logging/logging-best-practices/#2-do-use-log-levels-correctly



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to