Fixes lock check for prune exclude actions#6077
Conversation
Correctly checks the lock format so that exclude options for the prune command work correctly.
| if (parts.length == 2 && hostPortPredicate.test(HostAndPort.fromString(parts[1]))) { | ||
| messageOutput.accept("Deleting " + path + " from zookeeper"); | ||
| if (!dryRun) { | ||
| zoo.recursiveDelete(path, NodeMissingPolicy.SKIP); |
There was a problem hiding this comment.
The original SingletonLock code uses zapDirectory(zoo, path, ops) which just performs a recursive delete on the path after printing a log message.
| throws KeeperException, InterruptedException { | ||
| var lockData = ServiceLock.getLockData(zoo.getZooKeeper(), ServiceLock.path(path)); | ||
| if (lockData != null) { | ||
| String lockContent = new String(lockData, UTF_8); |
There was a problem hiding this comment.
Could the ServerServices code be used here to extract the address? Like this code
There was a problem hiding this comment.
Yes that would probably work. I'll look at making that change so we aren't going down multiple lock removal paths again
|
Pushing this change up for now. Going to see if ServerServices can be used to consolidate more of the lock code. |
|
The code in main is sufficiently different. I don't think the changes here or in #6073 should be merged to main. |
28d7fd1 to
900976c
Compare
|
|
||
| } | ||
|
|
||
| public static void removeLock(ZooReaderWriter zoo, String path, |
There was a problem hiding this comment.
Suggest naming this deleteLock like the other methods. This is just a different variant.
Correctly checks the lock format so that exclude options for the prune command work correctly.
Closes #6076