DomGarguilo commented on code in PR #6073:
URL: https://github.com/apache/accumulo/pull/6073#discussion_r2722577758
##########
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:
We do `zPath + "/" + server` a lot here. Would be nice to add a var for
that. Also once that var is created we should update the log message in this
method to use that because I think its logging the wrong path right now.
Also, my IDE is warning that `lockData` could be null. We might want to
handle that. Maybe skipping that `server` and logging or `messageOutput.accept`
that we skipped it.
##########
server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java:
##########
@@ -245,7 +245,7 @@ public void zap(SiteConfiguration siteConf, String... args)
{
if (opts.zapScanServers) {
String sserversPath = Constants.ZROOT + "/" + iid + Constants.ZSSERVERS;
try {
- removeGroupedLocks(zoo, sserversPath, groupPredicate,
hostPortPredicate, opts);
+ removeScanServerGroupLocks(zoo, sserversPath, hostPortPredicate,
groupPredicate, opts);
Review Comment:
I think we need to do something like this when `--include-groups` is not set.
```suggestion
if (opts.includeGroups == null) {
removeLocks(zoo, sserversPath, hostPortPredicate, opts);
} else {
removeScanServerGroupLocks(zoo, sserversPath, hostPortPredicate,
groupPredicate, opts);
}
```
--
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]