dlmarion commented on code in PR #4987:
URL: https://github.com/apache/accumulo/pull/4987#discussion_r1802954998


##########
core/src/main/java/org/apache/accumulo/core/lock/ServiceLockPaths.java:
##########
@@ -395,7 +429,29 @@ private Set<ServiceLockPath> get(final String serverType,
       final List<String> resourceGroups = cache.getChildren(typePath);
       for (final String group : resourceGroups) {
         if (resourceGroupPredicate.test(group)) {
-          final List<String> servers = cache.getChildren(typePath + "/" + 
group);
+          final Collection<String> servers;
+          final Predicate<String> addressPredicate;
+
+          if (addressSelector.getExactAddress() != null) {
+            var server = addressSelector.getExactAddress().toString();
+            if (withLock) {
+              // The server in the list may not exist, if it does not exist 
then no lock will be
+              // found later and nothing will be returned for the server.
+              servers = List.of(server);
+            } else if (cache.get(typePath + "/" + group + "/" + server) != 
null) {
+              // Since the lock will not be checked, looked for a node in 
zookeeper for the server
+              // and found it.
+              servers = List.of(addressSelector.getExactAddress().toString());

Review Comment:
   I think this is the same as `servers = List.of(server);`. Could probably 
merge this condition with the condition above.



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