You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "dlmarion (via GitHub)" <gi...@apache.org> on 2024/11/13 15:15:12 UTC

[PR] Added gc and monitor server types to public api [accumulo]

dlmarion opened a new pull request, #5055:
URL: https://github.com/apache/accumulo/pull/5055

   Added gc and monitor server types and ability to get their ServerId objects via InstanceOperations.getServers. The gc type will resolve an issue that I'm having in the new monitor PR, and the new types could be used for service discovery by clients. A recent comment by @keith-turner suggests that these could be used to get status via the API.


-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Added gc and monitor server types to public api [accumulo]

Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion merged PR #5055:
URL: https://github.com/apache/accumulo/pull/5055


-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Added gc and monitor server types to public api [accumulo]

Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on code in PR #5055:
URL: https://github.com/apache/accumulo/pull/5055#discussion_r1842285041


##########
core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java:
##########
@@ -501,6 +501,20 @@ public ServerId getServer(ServerId.Type type, String resourceGroup, String host,
         } else {
           return managers.iterator().next();
         }
+      case MONITOR:
+        Set<ServerId> monitors = getServers(type, rg2 -> true, hp);
+        if (monitors.isEmpty()) {
+          return null;
+        } else {
+          return monitors.iterator().next();
+        }
+      case GARBAGE_COLLECTOR:
+        Set<ServerId> gc = getServers(type, rg2 -> true, hp);
+        if (gc.isEmpty()) {
+          return null;
+        } else {
+          return gc.iterator().next();
+        }

Review Comment:
   I collapsed the cases, but I didn't replace `.iterator().next()` with `.stream().collect(MoreCollectors.onlyElement())`



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Added gc and monitor server types to public api [accumulo]

Posted by "DomGarguilo (via GitHub)" <gi...@apache.org>.
DomGarguilo commented on PR #5055:
URL: https://github.com/apache/accumulo/pull/5055#issuecomment-2474793129

   > I saw a bug that I'll have a fix for up in a sec so this PR should probably wait to include that before merging.
   
   The bug has been addressed as of #5056 


-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Added gc and monitor server types to public api [accumulo]

Posted by "DomGarguilo (via GitHub)" <gi...@apache.org>.
DomGarguilo commented on code in PR #5055:
URL: https://github.com/apache/accumulo/pull/5055#discussion_r1840753115


##########
core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java:
##########
@@ -501,6 +501,20 @@ public ServerId getServer(ServerId.Type type, String resourceGroup, String host,
         } else {
           return managers.iterator().next();
         }
+      case MONITOR:
+        Set<ServerId> monitors = getServers(type, rg2 -> true, hp);
+        if (monitors.isEmpty()) {
+          return null;
+        } else {
+          return monitors.iterator().next();
+        }
+      case GARBAGE_COLLECTOR:
+        Set<ServerId> gc = getServers(type, rg2 -> true, hp);
+        if (gc.isEmpty()) {
+          return null;
+        } else {
+          return gc.iterator().next();
+        }

Review Comment:
   ```suggestion
         case MANAGER:
         case MONITOR:
         case GARBAGE_COLLECTOR:
           Set<ServerId> server = getServers(type, rg2 -> true, hp);
           if (server.isEmpty()) {
             return null;
           } else {
             return server.stream().collect(MoreCollectors.onlyElement());
           }
   ```
   Looks like these three cases can be combined. Also added the use of `.collect(MoreCollectors.onlyElement())` since we are only expecting one of each of these servers but I am not sure if we want to include that here.



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org