clarax commented on a change in pull request #3732:
URL: https://github.com/apache/hbase/pull/3732#discussion_r744308525



##########
File path: 
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
##########
@@ -204,10 +209,11 @@ protected float getDefaultSlop() {
 
   protected List<CandidateGenerator> createCandidateGenerators() {
     List<CandidateGenerator> candidateGenerators = new 
ArrayList<CandidateGenerator>(4);
-    candidateGenerators.add(new RandomCandidateGenerator());
-    candidateGenerators.add(new LoadCandidateGenerator());
-    candidateGenerators.add(localityCandidateGenerator);
-    candidateGenerators.add(new RegionReplicaRackCandidateGenerator());
+    candidateGenerators.add(GeneratorType.RANDOM.ordinal(), new 
RandomCandidateGenerator());

Review comment:
       It is generally a good idea. Here I have tried to attach the generators. 
But Enum requires immutable objects. Two subclasses of Candidate Generators 
(FavoredNodeLoadPicker and FavoredNodeLocalityPicker )have a field for 
FavoredNodeManager, which can not be immutable. Given the limited number of 
types here, it is not too much gain to go down the rabbit hole at shown in the 
reverted commits.




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


Reply via email to