jiajunwang commented on a change in pull request #690: Reset the WAGED 
rebalancer once the controller newly acquires leadership.
URL: https://github.com/apache/helix/pull/690#discussion_r370341846
 
 

 ##########
 File path: 
helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
 ##########
 @@ -1259,3 +1287,54 @@ private void initPipeline(Thread eventThread, 
BaseControllerDataProvider cache)
     eventThread.start();
   }
 }
+
+/**
+ * A wrapper class for the WAGED rebalancer instance.
+ */
+class WagedRebalancerRef {
+  private WagedRebalancer _rebalancer = null;
+  private boolean _isRebalancerValid = true;
+
+  private void createWagedRebalancer(HelixManager helixManager) {
 
 Review comment:
   That's the first thing I tried, if we don't need the _isRebalancerValid 
flag, it works fine and we won't need to create StatefulRebalancerRef at all. 
Basically, in this case, we make the WAGED rebalancer singleton.
   However, since we have a flag that is not quite suitable for the WAGED 
class, it would be easier for me to put both the flag and the rebalancer in a 
StatefulRebalancerRef object. And the Ref class is for the 
GenericHelixController only. Given that done, the singleton pattern becomes 
optional.
   
   Moreover, it is concerning to make the WAGED rebalancer singleton. If we 
want to use it for both task framework and the resource rebalancer, or we want 
to manage different resources with different rebalancer configuration, 
singleton won't work. That's why I didn't pick up that design.

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