sreejasahithi commented on code in PR #10681:
URL: https://github.com/apache/ozone/pull/10681#discussion_r3544727291
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancer.java:
##########
@@ -397,6 +412,7 @@ public void stopBalancer()
saveConfiguration(config, false, 0);
if (isBalancerRunning()) {
LOG.info("Trying to stop ContainerBalancer service.");
+ task.recordStopReason("STOPPED_BY_USER");
Review Comment:
Right an enum is much cleaner and easy to maintain.
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancer.java:
##########
@@ -186,13 +186,27 @@ public ContainerBalancerTask.Status getBalancerStatus() {
public ContainerBalancerStatusInfo getBalancerStatusInfo() throws
IOException {
lock.lock();
try {
- if (isBalancerRunning()) {
+ if (task == null) {
+ return null;
+ }
+ ContainerBalancerTask.Status status = task.getBalancerStatus();
+ if (status == ContainerBalancerTask.Status.RUNNING
+ || status == ContainerBalancerTask.Status.STOPPING) {
Review Comment:
Yes, I intentionally left STOPPING without a stop reason since that state is
very brief.
--
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]