ddanielr commented on code in PR #6077:
URL: https://github.com/apache/accumulo/pull/6077#discussion_r2728038111


##########
core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ServiceLock.java:
##########
@@ -783,6 +784,22 @@ public static void deleteLock(ZooReaderWriter zk, 
ServiceLockPath path)
 
   }
 
+  public static void removeGCLock(ZooReaderWriter zoo, String path,
+      Predicate<HostAndPort> hostPortPredicate, Consumer<String> 
messageOutput, Boolean dryRun)
+      throws KeeperException, InterruptedException {
+    var lockData = ServiceLock.getLockData(zoo.getZooKeeper(), 
ServiceLock.path(path));
+    if (lockData != null) {
+      String lockContent = new String(lockData, UTF_8);
+      String[] parts = lockContent.split("=");
+      if (parts.length == 2 && 
hostPortPredicate.test(HostAndPort.fromString(parts[1]))) {
+        messageOutput.accept("Deleting " + path + " from zookeeper");
+        if (!dryRun) {
+          zoo.recursiveDelete(path, NodeMissingPolicy.SKIP);

Review Comment:
   The original SingletonLock code uses zapDirectory(zoo, path, ops) which just 
performs a recursive delete on the path after printing a log message.



-- 
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]

Reply via email to