diff --git a/core/src/main/java/org/apache/accumulo/core/lock/ServiceLock.java b/core/src/main/java/org/apache/accumulo/core/lock/ServiceLock.java index 3c7d72bd0fc..18aeda770a7 100644 --- a/core/src/main/java/org/apache/accumulo/core/lock/ServiceLock.java +++ b/core/src/main/java/org/apache/accumulo/core/lock/ServiceLock.java @@ -18,7 +18,6 @@ */ package org.apache.accumulo.core.lock; -import static java.nio.charset.StandardCharsets.UTF_8; import static java.util.Objects.requireNonNull; import static java.util.concurrent.TimeUnit.SECONDS; @@ -745,33 +744,6 @@ public static void deleteLock(ZooReaderWriter zk, ServiceLockPath path) } - public static boolean deleteLock(ZooReaderWriter zk, ServiceLockPath path, String lockData) - throws InterruptedException, KeeperException { - - List 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 IllegalStateException("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 17706c1c9cb..c97892a4c0c 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 @@ -144,7 +144,9 @@ public void zap(SiteConfiguration siteConf, String... args) { zrw.recursiveDelete(tserverPath.toString(), NodeMissingPolicy.SKIP); } else { if (!zrw.getChildren(tserverPath.toString()).isEmpty()) { - if (!ServiceLock.deleteLock(zrw, tserverPath, "tserver")) { + try { + ServiceLock.deleteLock(zrw, tserverPath); + } catch (RuntimeException e) { message("Did not delete " + tserverPath, opts); } }