rakeshadr commented on code in PR #10681:
URL: https://github.com/apache/ozone/pull/10681#discussion_r3575853866


##########
hadoop-ozone/cli-admin/src/main/java/org/apache/hadoop/hdds/scm/cli/ContainerBalancerStatusSubcommand.java:
##########


Review Comment:
   `verboseWithHistory` is checked inside `printVerboseStatusInfo`, which is 
only entered when `isVerbose()`. Running status` -H (without -v) `produces no 
history and no warning.
   
   Can you add a warn message to the user, at the very beginning of execute() 
before any RPC call.
   
    ```
    if (verboseWithHistory && !isVerbose()) {
       System.err.println("Warning: -H/--history has no effect without 
-v/--verbose.");
     }
   ```



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancerTask.java:
##########
@@ -264,8 +277,8 @@ private void balance() {
           return;
         }
         // otherwise, try to stop balancer
-        tryStopWithSaveConfiguration("Could not initialize " +
-            "ContainerBalancer's iteration number " + i);
+        
tryStopWithSaveConfiguration(ContainerBalancerStopReason.INITIALIZATION_FAILED,

Review Comment:
   Reset flag before calling tryStopWithSaveConfiguration on the init-failure 
path.
   
   ```
   isCurrentIterationInProgress.set(false);  // reset before returning
   
   
tryStopWithSaveConfiguration(ContainerBalancerStopReason.INITIALIZATION_FAILED,
               " iteration number " + (i + 1) + ", " + 
lastInitializationFailureDetail);
   
   .....
   .....
   ```



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java:
##########
@@ -1379,14 +1379,13 @@ public ContainerBalancerStatusInfoResponseProto 
getContainerBalancerStatusInfo()
           .newBuilder()
           .setIsRunning(false)
           .build();
-    } else {
-
-      return ContainerBalancerStatusInfoResponseProto
-          .newBuilder()
-          .setIsRunning(true)
-          .setContainerBalancerStatusInfo(balancerStatusInfo.toProto())
-          .build();
     }
+
+    return ContainerBalancerStatusInfoResponseProto
+        .newBuilder()
+        .setIsRunning(scm.getContainerBalancer().isBalancerRunning())

Review Comment:
   Can you use
   `balancerStatusInfo.getConfiguration().getShouldRun()` instead of  
isBalancerRunning(). 



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