pvary commented on code in PR #13795:
URL: https://github.com/apache/iceberg/pull/13795#discussion_r2276351253
##########
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(
Review Comment:
I don't think we would like to have a `warn` level log for failing to
acquire the lock. Max info
--
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]