siddhantsangwan commented on code in PR #6241:
URL: https://github.com/apache/ozone/pull/6241#discussion_r1507089835


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java:
##########
@@ -1105,6 +1111,54 @@ public StartContainerBalancerResponseProto 
startContainerBalancer(
       cbc.setMaxSizeLeavingSource(msls * OzoneConsts.GB);
     }
 
+    if (balancingInterval.isPresent()) {
+      long bi = balancingInterval.get();
+      auditMap.put("balancingInterval", String.valueOf(bi));
+      Preconditions.checkState(bi > 0,
+              "balancingInterval must be greater than zero.");
+      cbc.setBalancingInterval(bi);
+    }
+
+    if (moveTimeout.isPresent()) {
+      long mt = moveTimeout.get();
+      auditMap.put("moveTimeout", String.valueOf(mt));
+      Preconditions.checkState(mt > 0,
+              "moveTimeout must be greater than zero.");
+      cbc.setMoveTimeout(mt);
+    }
+
+    if (moveReplicationTimeout.isPresent()) {
+      long mrt = moveReplicationTimeout.get();
+      auditMap.put("moveReplicationTimeout", String.valueOf(mrt));
+      Preconditions.checkState(mrt > 0,
+              "moveTimeout must be greater than zero.");

Review Comment:
   @errose28 good point. I wonder if we can even skip throwing a checked 
exception and simply audit the failure, wrap the failure message in the 
response proto and send it back? 
   
   SCM client has retry and failover functionalities - the proxy will, by 
default (unless we explicitly code to not failover/retry for a particular 
exception), try to failover to a different SCM and retry the command there if 
it receives an `IOException`, for example. These retries are unnecessary in 
this case because the provided configs are incorrect. To change this behaviour 
we'd need to add some logic for the client to just fail and not retry or 
failover to another proxy. This is doable but more complicated.
   
   How about throwing at the client side instead if the command failed, so that 
it returns with a non zero exit code?
   ```
       if (response.getStart()) {
         System.out.println("Container Balancer started successfully.");
       } else {
         System.out.println("Failed to start Container Balancer.");
         if (response.hasMessage()) {
           System.out.printf("Failure reason: %s", response.getMessage());
         }
       }
   ```



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