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


##########
core/src/main/java/org/apache/accumulo/core/fate/zookeeper/ServiceLock.java:
##########
@@ -754,6 +755,39 @@ public static void deleteLocks(ZooReaderWriter zk, String 
zPath,
     }
   }
 
+  @Deprecated(since = "2.1.5")
+  public static void deleteScanServerLocks(ZooReaderWriter zk, String zPath,
+      Predicate<HostAndPort> hostPortPredicate, Predicate<String> 
groupPredicate,
+      Consumer<String> messageOutput, Boolean dryRun) throws KeeperException, 
InterruptedException {
+
+    Objects.requireNonNull(zPath, "Lock path cannot be null");
+    Objects.requireNonNull(groupPredicate, "group predicate cannot be null");
+    if (!zk.exists(zPath)) {
+      throw new IllegalStateException("Path " + zPath + " does not exist");
+    }
+
+    List<String> servers = zk.getChildren(zPath);
+    if (servers.isEmpty()) {
+      throw new IllegalStateException("No server locks are held at " + zPath);
+    }
+
+    ZooKeeper z = zk.getZooKeeper();
+    for (String server : servers) {
+      if (hostPortPredicate.test(HostAndPort.fromString(server))) {
+        byte[] lockData = ServiceLock.getLockData(z, path(zPath + "/" + 
server));
+        String lockContent = new String(lockData, UTF_8);

Review Comment:
   getLockData looks like it either returns an Optional.empty() or valid data. 
   ServiceLockData.parse seems to handle null checks so this might just need 
some optional handling. 
   
   Agree that `zPath + "/" + server` would be nice. I see the path log message 
issue on 783



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