i3wangyi commented on a change in pull request #639: Refine the WAGED 
rebalancer to minimize the partial rebalance workload.
URL: https://github.com/apache/helix/pull/639#discussion_r356792753
 
 

 ##########
 File path: 
helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/WagedRebalancer.java
 ##########
 @@ -296,7 +297,7 @@ public void close() {
   // Coordinate baseline recalculation and partial rebalance according to the 
cluster changes.
   private Map<String, IdealState> computeBestPossibleStates(
       ResourceControllerDataProvider clusterData, Map<String, Resource> 
resourceMap,
-      final CurrentStateOutput currentStateOutput)
+      final CurrentStateOutput currentStateOutput, RebalanceAlgorithm 
algorithm)
 
 Review comment:
   @jiajunwang could you not easily resolve the comment, I noticed GitHub PR 
review won't notify the reviewers some times.
   Now I understand why do you prefer to passing the instance in the method 
parameter (the value can be changed). However, the purpose of doing so is 
hidden beneath the code itself (it doesn't self explain IMO if the reader 
doesn't have a whole picture) and you have to pass the rebalance algorithm 
instance from method A -> B -> C... Why do you think a lock is heavy? I suppose 
a re-entrant lock is sufficient and way more readable as it makes other 
developers aware of the possible race condition immediately.  
   A private method like this should be good enough
   ```
   private RebalanceAlgorithm getRebalanceAlgorithm() {
      _reentrantLock.acquire();
      algorithm = getInstance();
      _retentranceLock.release();
   }
   ```

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


With regards,
Apache Git Services

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

Reply via email to