advancedxy commented on code in PR #938:
URL: https://github.com/apache/incubator-uniffle/pull/938#discussion_r1229684812


##########
server/src/main/java/org/apache/uniffle/server/ShuffleServer.java:
##########
@@ -457,6 +457,10 @@ public boolean isHealthy() {
     return isHealthy.get();
   }
 
+  public void setIsHealthy(AtomicBoolean isHealthy) {

Review Comment:
   +1. Passing an `AtomicBoolean` is super super weird. 



##########
coordinator/src/main/java/org/apache/uniffle/coordinator/web/servlet/NodesServlet.java:
##########
@@ -37,20 +37,36 @@ public NodesServlet(CoordinatorServer coordinator) {
   }
 
   @Override
-  protected Response<List<ServerNode>> handleGet(HttpServletRequest req, 
HttpServletResponse resp) {
-    List<ServerNode> serverList = 
coordinator.getClusterManager().getServerList(Collections.EMPTY_SET);
-    String id = req.getParameter("id");
-    String status = req.getParameter("status");
-    serverList = serverList.stream().filter((server) -> {
-      if (id != null && !id.equals(server.getId())) {
-        return false;
+  protected Response handleGet(HttpServletRequest req, HttpServletResponse 
resp) {
+    String requestURI = req.getRequestURI();
+    String methodName = requestURI.substring(requestURI.lastIndexOf("/"));
+    if (methodName == null || methodName.length() == 0) {
+      return Response.success("The requested address is incorrect, please 
confirm!");
+    } else {
+      if (methodName.equalsIgnoreCase("getUnhealthy")) {

Review Comment:
   > Currently, the url is like /api/server/nodes?status=ACTIVE, but in this 
pr, it will be like /api/server/nodes/getActive?status=ACTIVE, i think it is 
weird. In the future, i want to change it to be like /api/server/nodes/ACTIVE. 
   
   Agree with this, I think current impl is weird. @xianjingfeng are you going 
to refactor this in a follow-up pr? Otherwise, I don't think we should accept 
this change.



##########
coordinator/src/main/java/org/apache/uniffle/coordinator/SimpleClusterManager.java:
##########
@@ -259,6 +282,16 @@ public int getShuffleNodesMax() {
     return shuffleNodesMax;
   }
 
+  @VisibleForTesting
+  public Set<ServerNode> getLostNodes() {

Review Comment:
   is this method used anythere?



##########
coordinator/src/main/java/org/apache/uniffle/coordinator/ServerNode.java:
##########
@@ -160,12 +158,18 @@ public Set<String> getTags() {
   }
 
   public boolean isHealthy() {
-    return isHealthy;
+    return this.status == ServerStatus.UNHEALTHY ? false : true;

Review Comment:
   This should be optimized as `return this.status != ServerStatus.UNHEALTHY;`



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to