JacksonYao287 commented on a change in pull request #2278:
URL: https://github.com/apache/ozone/pull/2278#discussion_r646257935



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancer.java
##########
@@ -323,8 +344,22 @@ public static double calculateUtilization(
    * Stops ContainerBalancer.
    */
   public void stop() {

Review comment:
       thanks @lokeshj1703  for point out this! 
   
   >In a race condition it is possible for balancerRunning to be set as true 
but thread may not be running
   
   sorry, i can not find a condition like this. but i can find out a race 
condition that balancerRunning has been set to false , but the balance thread 
is still running.
   e.g. , `balancer#start` is triggered by cli  and `balanceRunning` is 
atomically set to true, but the balance thread is not been started , at this 
time , `balancer#stop` is triggered by cli, and `balanceRunning` is atomically 
set to false.then `balancer#start` continue to execute , and  a balance thread 
will be created and go on. so in this case , `balancerRunning` has been set to 
false , but the balance thread is still running. please correct me if i am 
wrong!
   
   but , in any case , start and stop should be synchronized. i will do this in 
a update commit




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

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