This is an automated email from the ASF dual-hosted git repository. dlmarion pushed a commit to branch 2.1 in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/2.1 by this push: new 712e50ed49 Removed call to ServiceLock that checked lock data equivalence (#5291) 712e50ed49 is described below commit 712e50ed49060d6db2046dbfb2430f0dc9412a5e Author: Dave Marion <dlmar...@apache.org> AuthorDate: Wed Jan 29 07:50:27 2025 -0500 Removed call to ServiceLock that checked lock data equivalence (#5291) Closes #5288 --- .../accumulo/core/fate/zookeeper/ServiceLock.java | 28 ---------------------- .../org/apache/accumulo/server/util/ZooZap.java | 4 +++- 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ServiceLock.java b/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ServiceLock.java index 375c2ef665..c6478baff3 100644 --- a/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ServiceLock.java +++ b/core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ServiceLock.java @@ -18,7 +18,6 @@ */ package org.apache.accumulo.core.fate.zookeeper; -import static java.nio.charset.StandardCharsets.UTF_8; import static java.util.Objects.requireNonNull; import java.util.ArrayList; @@ -736,33 +735,6 @@ public class ServiceLock implements Watcher { } - public static boolean deleteLock(ZooReaderWriter zk, ServiceLockPath path, String lockData) - throws InterruptedException, KeeperException { - - List<String> children = validateAndSort(path, zk.getChildren(path.toString())); - - if (children.isEmpty()) { - throw new IllegalStateException("No lock is held at " + path); - } - - String lockNode = children.get(0); - - if (!lockNode.startsWith(ZLOCK_PREFIX)) { - throw new RuntimeException("Node " + lockNode + " at " + path + " is not a lock node"); - } - - byte[] data = zk.getData(path + "/" + lockNode); - - if (lockData.equals(new String(data, UTF_8))) { - String pathToDelete = path + "/" + lockNode; - LOG.debug("Deleting all at path {} due to lock deletion", pathToDelete); - zk.recursiveDelete(pathToDelete, NodeMissingPolicy.FAIL); - return true; - } - - return false; - } - /** * Checks that the lock still exists in ZooKeeper. The typical mechanism for determining if a lock * is lost depends on a Watcher set on the lock node. There exists a case where the Watcher may diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java b/server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java index d16b9fe984..54c596ea05 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java @@ -141,7 +141,9 @@ public class ZooZap implements KeywordExecutable { } else { var zLockPath = ServiceLock.path(tserversPath + "/" + child); if (!zoo.getChildren(zLockPath.toString()).isEmpty()) { - if (!ServiceLock.deleteLock(zoo, zLockPath, "tserver")) { + try { + ServiceLock.deleteLock(zoo, zLockPath); + } catch (RuntimeException e) { message("Did not delete " + tserversPath + "/" + child, opts); } }